UPDATE语句:将一个表里的字段更新到另一个表的字段里的语句

update table2 b,(select b.area_id as arid,sum(a.user_amount) as bcount
from table1 a,table2 b
where a.user_area=b.area_id
group by arid) c
set b.count=c.bcount
where b.area_id=c.arid;
posted @ 2015-02-11 20:46  jshaibozhong  阅读(1059)  评论(0编辑  收藏  举报