更新时间:2023-09-23 10:56:22
尝试修改查询.以下行不应该是联接结构本身的一部分,而应该是联接结构的过滤器:
Try modifying the query. The following line should not be a part of the join structure itself, but rather a filter for the join structure:
OITW.WareHouseCode in ('WH1','WH2','WH4')
将其作为WHERE
子句放入:
Put it in as a WHERE
clause:
SELECT
OITM.ItemCode,
sum(StockHand - OrderQty) AS NetStockHand
FROM
OITM inner join
WITM on OITM.ItemCode = WITM.ItemCode inner join
OITW on OITM.ItemCode = OITW.ItemCode
WHERE
OITW.WareHouseCode in ('WH1','WH2','WH4')
GROUP BY
OITM.ItemCode
HAVING
sum(StockHand - OrderQty) <> WITM.LastUStock