select name, max(total_num) as grade_sum
from
user
left outer join
(select user_id, sum(grade_num) as total_num
from grade_info group by user_id) as grade
on user.id = grade.user_id
group by user_id
order by grade_sum desc
limit 0,1;
第一次运行出错,因为忘记了很重要的一点。即: