题解 | #获得积分最多的人(二)#
获得积分最多的人(二)
http://www.nowcoder.com/practice/b6248d075d2d4213948b2e768080dc92
select
u.id, u.name, sum(g.grade_num)
FROM grade_info as g join user as u
on g.user_id = u.id
group by g.user_id HAVING sum(g.grade_num) =
(select
sum(grade_num)
from grade_info
group by user_id order by sum(grade_num) desc limit 0, 1)
order by u.id