Hello again Kirupans, I have been here a lot lately the past 48 hours… because you guys are great for advice and suggestions.
I am trying to display a simple rankings system. In the Database I have something like this:
| user_id | score |
| 1 | 40 |
| 2 | 400 |
| 3 | 30 |
| 4 | 89 |
| 5 | 10 |
| 6 | 55 |
If I want to get the leaders, with the highest score at top, I would have my query something like this:
select distinct user_id
, sum(score
) as score
from score_list
group by user_id
order by score
desc;
This query would sort from the score list from first to last. What my problem is is trying to find out where that one user stands among the other users. For example, lets say there are 5000 "user_id"s, and I want to find out where user_id 5 stands among the 5000… like he could be very last or at the very top of the list… How do I find out where that user stands with out having to loop through the list?