Rank scores


  • 0
    A

    SELECT Scores.Score, CAST(Rank AS UNSIGNED) AS Rank
    FROM Scores
    JOIN
    (SELECT s.Score, @row_number:=@row_number+1 AS Rank FROM (SELECT DISTINCT Score FROM Scores ORDER BY Score DESC) AS s, (SELECT @row_number:=0) AS t) AS c ON Scores.Score = c.Score
    ORDER BY Rank ASC


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.