询问:
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
输出:
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
排名悲惨地没有告诉我真相,它基于user_id。谁能帮我?