窗口函数+嵌套子查询
select id,name,grade_sum from (select b.id as id, b.name as name, sum(a.grade_num) as grade_sum, dense_rank() over(order by sum(grade_num) desc) as rk from grade_info a left join user b on a.user_id = b.id group by user_id) where rk = 1 order by id;