select userno,sum(small_posttaxprize) t1 from lottery_order where order_result_status in (3,4) group by userno ; select userno, sum(commisionPrizeAmt+prizeAmt) t2 from lottery_caselot_buy group by userno; select userno,sum(small_posttaxprize) total from lottery_order where order_result_status in (3,4) group by userno; update user_account a inner join (select userno,sum(small_posttaxprize) total from lottery_order where order_result_status in (3,4) group by userno) c set total_prize_amt=c.total wherhere a.userno=c.userno; update user_account a inner join(select * from(select userno, sum(commisionPrizeAmt+prizeAmt) total from lottery_caselot_buy group by userno having total>0) t)tt set total_prize_amt=total_prize_amt+tt.total where a.userno=tt.userno;
mysql update sql
猜你喜欢
转载自stevenfeng.iteye.com/blog/2178589
今日推荐
周排行