我真的很难解决这个问题。我已经尝试了 FROM 部分的所有可能组合,但我似乎无法得到它。我试过逗号,混合内连接和左连接然后这个。
[ give some date pls]是参数提示(仅适用于 MS Access 2007),因此请忽略它。
它说我的 FROM 部分有问题。
SELECT
TJI.Serial AS ID,
FIRST(TJI.Product) AS Product,
ROUND((((SUM(TJI.JobOrder) * FIRST(TJI.ProductPackQTY)) - IIF(ISNULL(SUM(TJI.TheAmount)), 0, SUM(TJI.TheAmount))) / FIRST(TJI.STDYield)) / FIRST(TJI.MinBatch), 0) * FIRST(TJI.MinBatch) AS Batch,
IIF(Batch <= 0, FIRST(MinBatch), Batch) AS FinalBatch
FROM TBL_JO AS TJ INNER JOIN (SELECT * FROM TBL_JOITEMS LEFT JOIN RET_STOCKS ON (Serial = TheItemSerial AND TJ.Date = TheDate) AS TJI ON TJ.Serial = TJI.JO_Serial
WHERE (TJ.Date = [give some date pls])
GROUP BY TJI.Serial