首先看一张图片
select max(paymoney) as mp,user_name from users_buy group by user_name //第一步
更新语句也可以 inner join
update users_score a INNER JOIN
(select max(paymoney) as mp,user_name from users_buy group by user_name ) b
on a.user_name=b.user_name
set a.user_score= a.user_score+(b.mp*0.1)
`