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;
时间: 2024-08-24 10:33:15
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;