Why doesn't this work?

  • 0


    My query does not work because its output is {"headers": ["Score", "Rank"], "values": [[null, 1]]} when the input is empty. Any hint?

    # Write your MySQL query statement below
    SELECT s1.Score AS Score, COUNT(DISTINCT(s2.Score)) + 1 AS Rank 
    FROM Scores s1, Scores s2 
    WHERE s2.Score > s1.Score
    ORDER BY s1.Score DESC

  • 0

    set @counter:=0;

    select Score ,@counter:=@counter+1 as Rank

    from Scores

    order by Score desc;

Log in to reply

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