简介

select user.id, user.name,t.grade_sum 
from (
    select user_id,sum(grade_num) as grade_sum 
    from grade_info group by user_id
    having grade_sum = 
        ( select sum(grade_num) as grade_sum from grade_info 
          group by user_id order by grade_sum desc limit 1) 
) t
inner join user
on t.user_id=user.id
order by user.id
posted on 2021-07-01 16:17  HDU李少帅  阅读(117)  评论(1编辑  收藏  举报