Accepted solution 612ms


  • 0
    F

    select tb1.Score, tb2.Rank from
    (select Score from Scores order by Score desc) tb1
    left join
    (select @rownum:=@rownum + 1 AS Rank, s.Score as Score from (select @rownum:=0) r,
    (select distinct(Score) as Score from Scores order by Score desc) s) tb2
    on tb1.Score = tb2.Score;


Log in to reply
 

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