这道题学习到了临时表的用法
感觉这样套娃少一点

WITH t AS (SELECT u.id,u.name,SUM(g.grade_num)AS grade_sum
FROM user u JOIN grade_info g
ON u.id=g.user_id
GROUP BY u.id)
SELECT id,name,grade_sum FROM t
WHERE grade_sum=(select MAX(grade_sum) FROM t)
order by id