I have a database called "playerrank" that has points column. I want to show on people's profile page their rank like this:
Rank: 3/1456
I tried using ROW_NUMBER() but it seems like my host has low version (5.7 i believe).its giving me errors.
Is there another way i can get the ranking of a player based on points other than ordering the db by points desc and getting the row number somehow?
In MySQL 5.7, in a single query
SELECT
(@row_number := @row_number + 1) AS rnk, points
FROM yourTable,
(SELECT @row_number := 0) AS x
ORDER BY points DESC;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With