出库入库查库存
答案:1 悬赏:40 手机版
解决时间 2021-04-26 07:29
- 提问者网友:爱了却不能说
- 2021-04-25 12:00
最佳答案
- 五星知识达人网友:忘川信使
- 2021-04-25 12:37
select b.MaterialID,b.BatchID,b.StoreSiteID,d.入库总量,c.出库总量,isnull(d.入库总量-c.出库总量,d.入库总量 )as 库存
from ((select MaterialID,BatchID,StoreSiteID from T_YarnOutstockDetail union select MaterialID,BatchID,StoreSiteID
from T_YarnInstockDetail) as b left join
(select MaterialID,BatchID,StoreSiteID, sum(Quantity) AS 出库总量 from T_YarnOutstockDetail GROUP BY MaterialID,BatchID,StoreSiteID) as c on b.MaterialID=c.MaterialID) left join
(select MaterialID,BatchID,StoreSiteID, sum(Quantity) AS 入库总量 from T_YarnInstockDetail GROUP BY MaterialID,BatchID,StoreSiteID) as d
on b.MaterialID=d.MaterialID
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯