题解 | #获得积分最多的人(二)#平平无奇的子查询解法
获得积分最多的人(二)
http://www.nowcoder.com/practice/b6248d075d2d4213948b2e768080dc92
-- 平平无奇的子查询解法,用稠密排序开了个窗 select user_id,name,grade_sum from( select g.user_id,u.id,u.name,sum(grade_num) as grade_sum,dense_rank()over(order by sum(grade_num) desc) as t_rank from grade_info g left join user u on g.user_id=u.id group by user_id) c where c.t_rank=1 order by c.id;