select t.id,t.name,t.grade_sum from (
select id,name,sum(grade_num) as grade_sum,rank() over (order by sum(grade_num) desc) as rank_sum
from grade_info g left join user u on g.user_id=u.id
group by id) t
where t.rank_sum=1
order by id;
select t.id,t.name,t.grade_sum from (
select id,name,sum(grade_num) as grade_sum,rank() over (order by sum(grade_num) desc) as rank_sum
from grade_info g left join user u on g.user_id=u.id
group by id) t
where t.rank_sum=1
order by id;