mysql分组求和查询并更新到另一张表

update fa_user u inner join (select sum(num) as total_withdraw_2,user_id from `fa_withdrawal_log` as l  where  l.status=1 group by l.user_id) as ll on ll.user_id=u.id set u.total_withdraw = ll.total_withdraw_2

网上找了几个都不能解决我的问题,这个比较好一点

猜你喜欢

转载自blog.csdn.net/sinat_25884075/article/details/130257011
今日推荐