score board

F

Franky

hi all, I want to make a score board. i have this table with scoreId ,
playerId and score. Not all players have same amount of scores. Some have
only 4 others have 200. I need a query that gives me the top 10 scores for
each player . I tried Select top 10 but that wasn't working. Thanks, Franky.
 
M

Michel Walsh

Hi,


SELECT a.*
FROM scores As a
WHERE a.scoreValue IN( SELECT TOP 10 b.scoreValue
FROM scores As b
WHERE a.playerID = b.playerID
ORDER BY b.scoreValue DESC)

ORDER BY a.playerID, a.scoreValue DESC



The last order by is not required, here, it is just used for "disposition" .



Franky said:
hi all, I want to make a score board. i have this table with scoreId ,
playerId and score. Not all players have same amount of scores. Some have
only 4 others have 200. I need a query that gives me the top 10 scores for
each player . I tried Select top 10 but that wasn't working. Thanks,
Franky.
 
Top