my approved solution

  • 0

    set @rank=0;
    select Scores.Score, row_num as Rank
    from Scores
    left join
    (select t1.Score, @rank:=@rank+1 as row_num
    (select distinct Score from Scores
    order by Score desc) as t1) as t2
    on Scores.Score=t2.Score
    order by Scores.Score desc

Log in to reply

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