1.首先进行连表查询将所需要的子表信息查询出来;2.对临时表进行分组,排序去第一条记录select t.name,sum(t.grade_num) as grade_sum from (select g.user_id,u.name,g.grade_num from grade_info g left join user u on g.user_id = u.id) as t group by t.user_id order by sum(t.grade_num) desc limit 0,1;