leetcode-分数排名

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

从这道题可以看出,可以广泛的思考利用子查询求解局部。

还有就是子查询中where Score>=s.Score里面的s不能省略,在子查询中必须有指代的表名

发布了48 篇原创文章 · 获赞 0 · 访问量 4336

猜你喜欢

转载自blog.csdn.net/weixin_41327340/article/details/103753608