题解 | #获得积分最多的人(二)#
获得积分最多的人(二)
http://www.nowcoder.com/practice/b6248d075d2d4213948b2e768080dc92
select
g.user_id,
u.name,
g.grade_num
from
(
select
user_id, sum(grade_num) grade_num
from
`grade_info`
group by
user_id)g
left join `user` u on
g.user_id = u.id
where
g.grade_num = (
select
max(grade_num)
from
(
select
user_id, sum(grade_num) grade_num
from
`grade_info`
group by
user_id)s)
order by
g.user_id