Answer the question
In order to leave comments, you need to log in
Numbering in sorted sql query?
Hey! You need to number the top list of users!
That is, the highest rated user has number 1 and so on down
Sorting goes DESC from the user's rating
SELECT u.id, u.avatar_path, u.rating, ROW_NUMBER() over() AS num
FROM users AS u
ORDER BY u.rating DESC;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question