场景案例:多表关联update(用户积分奖励)

场景:
ide

根据运营需求,譬如咱们 规定 在 某2天内,凡是消费的客户给予 消费金额的10%做为积分奖励,it

以最大的一天为准,不累加 。class


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 date

set a.user_score= a.user_score+(b.mp*0.1)select

相关文章
相关标签/搜索