|
做了一个先进先出的系统,运行如下SQL 总是发现“data type mismatch in criteria expression”,哪里出错了?急着用于海关报关。多谢!
SELECT o.odate, o.Out_Date, o.SKU, o.PKT, o.Order_Nbr, o.Outbound_Job, o.Country, o.SKU_DESC, iif
(i.accQty<o.accQty,i.accQty,o.accQty) - iif(i.paccQty>o.paccQty,i.paccQty,o.paccQty) AS ActualIssureQty4Batch, i.idate, i.REF_FIELD_2, i.VERF_DATE_TIME
FROM (SELECT Val(Year(VERF_DATE_TIME) & Month(VERF_DATE_TIME) & Day(VERF_DATE_TIME)) AS idate, VERF_DATE_TIME, DSP_SKU,
UNITS_RCVD,REF_FIELD_2,Val(DSum('UNITS_RCVD','FIFO_in','DSP_SKU="' & DSP_SKU & '" and Val(Year(VERF_DATE_TIME) & Month(VERF_DATE_TIME) & Day(VERF_DATE_TIME))<=' & Val(Year(VERF_DATE_TIME) & Month(VERF_DATE_TIME) & Day(VERF_DATE_TIME)))) AS
accQty, accQty-UNITS_RCVD AS paccQty
FROM FIFO_in
ORDER BY Val(Year(VERF_DATE_TIME) & Month(VERF_DATE_TIME) & Day(VERF_DATE_TIME))
) AS i INNER JOIN (SELECT Val(Year(Out_Date) & Month(Out_Date) & Day(Out_Date)) AS odate, Out_Date, SKU, SKU_DESC,Out_QTY,PKT,Order_Nbr,Outbound_Job,Country,
Val(DSum('Out_QTY','FIFO_out','SKU="' & SKU & '" and Val(Year(Out_Date) & Month(Out_Date) & Day(Out_Date))<=' & Val(Year(Out_Date) & Month(Out_Date) & Day(Out_Date)))) AS accQty, accQty-Out_QTY AS paccQty
FROM FIFO_out
ORDER BY Val(Year(Out_Date) & Month(Out_Date) & Day(Out_Date))
) AS o ON (i.DSP_SKU=o.SKU) AND (i.accQty>o.paccQty) AND (i.paccQty<o.accQty)
ORDER BY o.odate, i.idate; |
|