my solution~~(after i read the answer of the discuss)


  • 0
    H

    select Scores.Score as Score,c.Rank as Rank from Scores left join
    (select a.Score as Score,count(*) as Rank from (select distinct(Score) as Score from Scores order by Score asc) as a,
    (select distinct(Score) as Score from Scores order by Score asc) as b
    where a.Score>=b.Score group by b.Score) as c on Scores.Score=c.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.