MySQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMySQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 7th, 2000, 11:56 AM
TNT TNT is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Posts: 4 TNT User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Here is the table: (bowler)

ID Name Game
1 Joe 215
2 Eric 289
3 Scott 278
4 Eric 245
5 Mark 280
6 Joe 289
7 Bob 278
8 Scott 270
9 Scott 278
10 Eric 289

This is the results I need:

Eric 289
Joe 289
Mark 280
Scott 278
Bob 278

The order for names that have the same Game is not important, so for 289 it could be:
Joe 289
Eric 289

I have tried so many things I cant even remember what they all are. I have probably tried some more then once.
If anyone has any suggestions, please help.

Eric

Reply With Quote
  #2  
Old September 7th, 2000, 12:40 PM
wouterr wouterr is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 27 wouterr User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
try
"select name,game from bowler order by game"

Reply With Quote
  #3  
Old September 7th, 2000, 12:56 PM
RyanP
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
i'm having trouble with this too, i tried:

SELECT Name, max(Game)
FROM Bowler
GROUP BY Name
ORDER BY Game DESC

but that gave me:
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
+-------+-----------+
| Name | max(Game) |
+-------+-----------+
| Eric | 289 |
| Mark | 280 |
| Scott | 278 |
| Bob | 278 |
| Joe | 289 |
+-------+-----------+
[/code]
the GROUP BY and ORDER BY clauses don't seem to be working together

Reply With Quote
  #4  
Old September 7th, 2000, 02:46 PM
rod k rod k is offline
Apprentice Deity
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jul 1999
Location: Niagara Falls (On the wrong side of the gorge)
Posts: 3,237 rod k User rank is Private First Class (20 - 50 Reputation Level)rod k User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 m 8 sec
Reputation Power: 13
Send a message via AIM to rod k
Ryan,

You need to order by max(game) not game. Alias it to make it easier:

select name,max(game) as mgame from bowler
group by name
order by mgame;

Reply With Quote
  #5  
Old September 7th, 2000, 03:34 PM
RyanP
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
oh! thanks rod

so eric, try:

SELECT Name, max(Game) AS maxGame
FROM Bowler
GROUP BY Name
ORDER BY maxGame DESC, Name

and you should get:
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
+-------+---------+
| name | maxgame |
+-------+---------+
| Eric | 289 |
| Joe | 289 |
| Mark | 280 |
| Bob | 278 |
| Scott | 278 |
+-------+---------+
[/code]

Reply With Quote
  #6  
Old September 8th, 2000, 01:54 AM
TNT TNT is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Posts: 4 TNT User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thank you so very much Rod and Ryan for the help.
This worked perfectly.

If you wish to see this working.
http://www.mountainlaneswausau.com/
Click on High Scores for the Year

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > GROUP BY - ORDER BY


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway