|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
我有5个工作表,表头分别为:
[采购进料$]:库别 |库位 |料号 | 品名 | 采购数量 | 项目 |机种 | 单价 | 采购金额
[工单领料$]:库别 | 库位 | 料号 |品名 |领料数量 | 项目 | 机种 |单价 |领料金额
[工单入库$]:库别 | 库位 | 料号 | 品名 |入库数量 |项目 | 机种 | 单价 |入库金额
[总库存$]: 库别 | 库位 | 料号| 品名| 库存数量| 项目 | 机种 | 单价 | 库存金额
[成品出货$]:库别 | 库位 | 料号 | 品名 | 出货数量 | 项目 | 机种 | 单价 | 出货金额
我现在需要做成SQL透视表,语句如下:
SELECT 库别,库位,料号,品名,采购数量,项目,机种,采购金额,0 AS 领料数量,0 AS 领料金额,0 AS 入库数量,0 AS 入库金额,0 AS 库存数量,0 AS 库存金额,0 AS 出货数量,0 AS 出货金额 FROM [采购进料$] UNION ALL
SELECT 库别,库位,料号,品名,0 AS 采购数量,项目,机种,0 AS 采购金额,领料数量,领料金额,0 AS 入库数量,0 AS 入库金额,0 AS 库存数量,0 AS 库存金额,0 AS 出货数量,0 AS 出货金额 FROM [工单领料$] UNION ALL
SELECT 库别,库位,料号,品名,0 AS 采购数量,项目,机种,0 AS 采购金额,0 AS 领料数量,0 AS 领料金额,入库数量,入库金额,0 AS 库存数量,0 AS 库存金额,0 AS 出货数量,0 AS 出货金额 FROM [工单入库$] UNION ALL
SELECT 库别,库位,料号,品名,0 AS 采购数量,项目,机种,0 AS 采购金额,0 AS 领料数量,0 AS 领料金额,0 AS 入库数量,0 AS 入库金额,库存数量,库存金额,0 AS 出货数量,0 AS 出货金额 FROM [总库存$] UNION ALL
SELECT 库别,库位,料号,品名,0 AS 采购数量,项目,机种,0 AS 采购金额,0 AS 领料数量,0 AS 领料金额,0 AS 入库数量,0 AS 入库金额,0 AS 库存数量,0 AS 库存金额,出货数量,出货金额 FROM [成品出货$]
限于格式,表头的字段位置固定不能更改。
将“项目,机种,”两个字段换了几次位置,均有问题~~
请教哪位能够帮我指点一下,谢谢!! |
|