Rank Scores


  • 0
    W
    # Write your MySQL query statement below
    select a2.score,a1.rank
    from
    (select t.s1,count(t.s2) rank
    from
    (select t1.score s1,t2.score s2
    from
    (select score from scores group by score) t1,
    (select score from scores group by score) t2
    ) t
    where t.s1 <= t.s2
    group by t.s1
    order by t.s1 desc
    ) a1,
    scores a2
    where a1.s1 = a2.score
    order by a2.score desc
    

Log in to reply
 

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