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