商品入库视图
SELECT a."商品ID", b."商品名称", c."ID" AS "库位ID", c."库位名称", SUM(a."数量") AS "入库数量"
FROM "出入库明细" a
LEFT JOIN "FGC_商品信息表" b
ON a."商品ID" = b."商品ID"
LEFT JOIN "库位表" c
ON a."入库库位ID" = c."ID"
GROUP BY a."商品ID", a."入库库位ID"
商品出库视图
SELECT a."商品ID", b."商品名称", c."ID" AS "库位ID", c."库位名称", SUM(a."数量") AS "出库数量"
FROM "出入库明细" a
LEFT JOIN "FGC_商品信息表" b
ON a."商品ID" = b."商品ID"
LEFT JOIN "库位表" c
ON a."出库库位ID" = c."ID"
GROUP BY a."商品ID", a."出库库位ID"
请教一下大佬,这个abc.xxx的abc是哪里来的,,left join是什么意思,或者哪里有这些代码的含义可以查阅吗?比如什么网址之类的
库存视图
SELECT "商品名称", "库位名称", SUM("入库数量") - SUM("出库数量") AS "库存"
FROM (
SELECT "商品名称", "库位名称", "入库数量", 0 AS "出库数量"
FROM "商品入库视图"
UNION ALL
SELECT "商品名称", "库位名称", 0 AS "入库数量", "出库数量"
FROM "商品出库视图"
) GROUP BY "商品名称", "库位名称"
还有这个也看不是很懂
|