U8 存货期初余额 货位

一、InvpositionSum:存货货位存量表测试

二、invPosition:存货货位记录表code

三、期初:select a.cwhcode,b.cinvcode,b.iquantity,isnull(b.cfree1,'测试') cfree1,isnull(b.cfree2,'测试') cfree2,isnull(b.cfree3,'测试') cfree3,b.cposition from rdrecord34 a left join rdrecords34 b on a.id=b.idci

1是2的group合计it

2和3一一对应io

期初出错删除顺序:date

delete from Rdrecords34 where id in (select id from Rdrecord34 where cwhcode ='214')select

delete from Rdrecord34 where cwhcode ='214'd3

delete from invPosition where cwhcode ='214'ant

delete from InvpositionSum where cwhcode ='214'co

修改自由项

update InvpositionSum set cfree1=UFDATA_006_2018..qichukucun.cfree1 from UFDATA_006_2018..qichukucun

where InvpositionSum.autoid=UFDATA_006_2018..qichukucun.autoid

 

select * from (select a.cwhcode,b.cinvcode,b.iquantity,isnull(b.cfree1,'测试') cfree1,isnull(b.cfree2,'测试') cfree2,isnull(b.cfree3,'测试') cfree3,b.cposition from rdrecord34 a left join rdrecords34 b on a.id=b.id ) c left join

(select cwhcode,cinvcode,iquantity,(case cfree1 when '' then '测试' else cfree1 end) cfree1,(case cfree2 when '' then '测试' else cfree2 end) cfree2,(case cfree3 when '' then '测试' else cfree3 end) cfree3,cposcode from InvpositionSum ) d on

c.cwhcode=d.cwhcode and c.cinvcode=d.cinvcode and c.cposition=d.cposcode and c.cfree1=d.cfree1 and c.cfree2=d.cfree2 and c.cfree3=d.cfree3

相关文章
相关标签/搜索