I have a table, users, that contains information about the user and also user points (I'm running a scoring system).
I'm wondering which way is the best to get a users ranking according to the points.
That is, I want to display the users ranking generated by the following query "SELECT * FROM users GROUP BY Points ORDER BY Points DESC"
Thanks.
Best way to get result position in mysql query?
Moderator: General Moderators
Run a second (or sub) query to select a count of those with a score greater than the player's.
Code: Select all
SELECT COUNT(*) FROM players WHERE score > (SELECT score FROM players WHERE player_id = <the players id>)