Query:
SELECT u.user_id,r.totalVotes votes,r.totalPoints rating,@row:=@row+1 rank
FROM mismatch_user u
LEFT JOIN ratingItems r ON u.user_id=r.uniqueName,
(SELECT @row:=0) pos
ORDER BY votes DESC,rating DESC
Output:
user_id votes rating rank
2 2 10 2
6 2 9 6
3 2 5 3
1 1 5 1
4 1 5 4
27 1 5 27
9 0 0 9
The ranking miserably not telling me the truth and it’s basing on the user_id. Can anyone help me?
Does this help?