|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
try
"select name,game from bowler order by game" |
|
#3
|
|||
|
|||
|
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 |
|
#4
|
|||
|
|||
|
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; |
|
#5
|
|||
|
|||
|
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] |
|
#6
|
|||
|
|||
|
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 |
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > GROUP BY - ORDER BY |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|