with t_base as (
select u.id,name,
sum(g.grade_num)  as total
from 
user u  inner join grade_info g on u.id=g.user_id
where g.type='add'
group by u.id,name 
)

select distinct id,name,total from 
t_base
where total =
(select max(total)
from t_base
)