select A1.*,A2.订单数量 from
(select 物料长代码,物料名称,规格型号,实收数量 as 上月入库数量,0 as 本月入库数量,0 as 上月发货数量,0 as 本月发货数量,0 as 库存数量 from [上月入库数量$] union all
select 物料长代码,物料名称,规格型号,0 as 上月入库数量,实收数量 as 本月入库数量,0 as 上月发货数量,0 as 本月发货数量,0 as 库存数量 from [本月入库数量$] union all
select 物料长代码,物料名称,规格型号,0 as 上月入库数量,0 as 本月入库数量,基本单位调拨数量 as 上月发货数量,0 as 本月发货数量,0 as 库存数量 from [上月发货数量$] union all select 物料长代码,物料名称,规格型号,0 as 上月入库数量,0 as 本月入库数量,0 as 上月发货数量,基本单位调拨数量 as 本月发货数量,0 as 库存数量 from [本月发货数量$] union all select 物料长代码,物料名称,规格型号,0 as 上月入库数量,0 as 本月入库数量,0 as 上月发货数量,0 as 本月发货数量,基本单位数量 as 库存数量 from [现时库存$])A1,
(select 物料长编码,物料名称,订单数量 from [排产计划$])A2
where A1.物料长代码=A2.物料长编码 and A1.物料名称=A2.物料名称
仔细对比一下,这是正确的语句哦!~~~ |