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

相關文章
相關標籤/搜索