hi,
Supposing I have a score's table, something like:
45, spiderman, 123
23, batman, 77
76, catwoman, 98
34, Wolverine, 156
which is: score_id, nickname, max points
How would I get something like (if it's possible):
1, Wolverine, 156
2, spiderman, 123
3, catwoman, 98
4, batman, 77
i.e., I want to get the position they are at, the numbers: 1, 2, 3, 4, which will depend on the score.
In order to have just
Wolverine, 156
spiderman, 123
catwoman, 98
batman, 77
I'd do something like:
SELECT nickname, max_points
FROM `points`
ORDER BY max_points DESC
LIMIT 4
I know there are workarounds to do this using PHP (a variable inside a while($row = mysql_fetch_assoc($result))), but I need it to appear in the recordset directly, using SQL only.
Is it possible?