解决方案: |
执行下列脚本修改:
update pp_podetails
set foutquantity=iquantity
from (select * from (select cmpocode,cpspcode,cinvcode,sum(iquantity) as iquantity
from rdrecord rd inner join rdrecords rs on rd.id=rs.id
where cmpocode is not null and cpspcode is not null and cvouchtype='11'
group by cmpocode,cpspcode,cinvcode) as lld
inner join (select po.ccode,pom.mainid,pom.cinvcode as cparentcode,pod.subid,pod.cinvcode as csoncode
from pp_productpo po
inner join pp_pomain pom on po.id=pom.id
inner join pp_podetails pod on pom.mainid=pod.mainid where pod.mainid is not null) as scdd
on lld.cmpocode=scdd.ccode
and lld.cpspcode=scdd.cparentcode
and lld.cinvcode=scdd.csoncode) as fout
inner join pp_podetails on pp_podetails.subid=fout.subid |