It can work in my local machine ,my sql 5.6 but does't work here

  • 0

    select T1.Score,T1.rank from (select Score ,
    case when @last > Score then @rank := @rank +1
    when @last = @last:=Score then @rank := @rank
    end as rank
    from Scores order by Score DESC ) T1,
    (select @rank:=1 ,@last :=(select Score from Scores order By Score DESC limit 0,1)) T2

Log in to reply

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