How to get a ranking result for special record in mysql [closed]

You want to get the rank in MySQL. Here is one approach:

SELECT id, name, @rn := @rn+1 as `rank`
from `users` cross join (select @rn := 0) const
ORDER BY points desc

Leave a Comment