|
做一个先进先出的模块,其中一个查询总是提示:"Invalid bracketing name 'SELECT op, sku, qty, DSum('qty','FIFO_in','SKU="' & sku & '"and val(right(op,3)) <= ' & Val(Right(op,3))) AS accQty, accQty-qty AS paccQty
FROM FIFO_in
ORDER BY op
以下为完整语句,可能错在from语句,请教更改。原文件附上。万分急用!!!
SELECT o.oid, o.ORD_NBR, o.SHIPTO_CNTRY, o.CNTRY_DESC, o.Port, o.SKU, o.QTY, iif(i.accQty<o.accQty,i.accQty,o.accQty)-iif(i.paccQty>o.paccQty,i.paccQty,o.paccQty) AS ActualIssureQty4Batc, i.op
FROM [SELECT op, sku, qty, DSum('qty','FIFO_in','SKU="' & sku & '"and val(right(op,3)) <= ' & Val(Right(op,3))) AS accQty, accQty-qty AS paccQty
FROM FIFO_in
ORDER BY op
] AS i INNER JOIN [SELECT oid, ORD_NBR, SHIPTO_CNTRY, CNTRY_DESC, Port, SKU, QTY, DSum('qty','FIFO_out','SKU="' & sku & '" and oid <= ' & oid) AS accQty, accQty-qty AS paccQty
FROM FIFO_out
ORDER BY oid
] AS o ON (i.SKU=o.SKU) AND (i.accQty>o.paccQty) AND (i.paccQty<o.accQty)
ORDER BY o.oid, i.op,o.SKU; |
|