178. Rank Scores

  • 0

    set @rownum=0;
    select a.Score as Score,a.rownumber as Rank from (
    select score, @rownum:=@rownum+1 as rownumber from (select distinct score from Scores)s order by score desc)a,Scores s where a.score=s.Score order by a.rownumber asc;

Log in to reply

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