题解 | #获得积分最多的人(二)#
获得积分最多的人(二)
http://www.nowcoder.com/practice/b6248d075d2d4213948b2e768080dc92
with total as( select a.id,name,sum(grade_num) over(partition by name)as grade_sum from user a left join grade_info b on a.id=b.user_id order by grade_sum desc ) select id,name,grade_sum from total where grade_sum in( select max(grade_sum) from total ) group by id order by id