日期:2014-05-16 浏览次数:20590 次
select a.FItemID '物料代码',
isnull(b.FQty1,0) '在库数',
isnull(c.FQty2,0) '在购数'
from dba1.dbo.t_Item a
left join
(select FItemID,sum(FQty) 'FQty1'
from dba1.dbo.ICInventory
group by FItemID) b on a.FItemID=b.FItemID
left join
(select FItemID,sum(FQty) 'FQty2'
from dba1.dbo.POOrderEntry
group by FItemID) c on a.FItemID=c.FItemID
where a.FItemClassID=4
select a.FItemID as '物料代码',isnull(b.在库数,0) as '在库数' ,isnull(c.在购数,0) as '在购数'
from t_Item a left join
(
select FItemID,sum(FQty) as '在库数' from ICInventory group by FItemID
)b on a.FItemID=b.FItemID left join
(
select FItemID ,sum(FQty) as '在购数' from POOrderEntry group by FItemID
)c on a.FItemID=c.FItemID
where a.FItemID=4
select a.FItemID '物料代码',
isnull(b.FQty1,0) '在库数',
isnull(c.FQty2,0) '在购数'
from dba1.dbo.t_Item a
left join
(select FItemID,sum(FQty) [FQty1]
from dba1.dbo.ICInventory
group by FItemID) b on a.FItemID=b.FItemID
left join
(select FItemID,sum(FQty) [FQty2]
from dba1.dbo.POOrderEntry
group by FItemID) c on a.FItemID=c.FItemID
where a.FItemClassID=4