解决方案: |
执行如下语句即可解决:
drop table a
select
ia_subsidiary.cwhcode,ia_subsidiary.cinvcode,sumiainquantity as iainquantity,sumiainprice as iainprice into a from ia_subsidiary join ia_summary
on ia_subsidiary.cwhcode=ia_summary.cwhcode and
ia_subsidiary.cinvcode=ia_summary.cinvcode
where ia_subsidiary.imonth=12 and cvoutype=‘30‘
and ia_subsidiary.cbustype=‘普通采购‘and
ia_summary.imonth=‘12‘
group by ia_subsidiary.cwhcode,ia_subsidiary.cinvcode
update ia_summary
set iinum=iinum-a.iainquantity,inum=inum-a.iainquantity,iimoney=iimoney-a.iainprice,imoney=imoney-a.iainprice
from a join ia_summary on a.cwhcode=ia_summary.cwhcode and a.cinvcode=ia_summary.cinvcode
where ia_summary.imonth=‘12‘ |