LeetCode

    对分数排序  参考了网上的答案  而且如果不Order by 有一个BUG就是 如果表为空则什么都不输出包括null才是正确的。

   

# Write your MySQL query statement below
select s.Score, count(rank.Score) as Rank
from Scores s,(
     select distinct Score from Scores
) rank
where s.Score <= rank.Score
group by s.Id
order by s.Score desc;

  

原文地址:https://www.cnblogs.com/wxisme/p/4443051.html