let's say for simplicity that i have a 'results' table
create table results (
where i log results from a game (user points)
it's easy to make standing stmt which group the players
and order them in desc points order.
select * from results group by player_id order by points desc.
but what if i want to know what's the position of a specific player (for example player_id = 123) with one sql stmt.
now i make a standing stmt and search the results until i found the needed player- it make take about unwanted 3000 compares before i found that he is on 3000-th place.
should i improve my search on php level or there is an sql stmt
that should do the hard work.
if anybody could give me any references, i'll be gratefull.