0
我有一個查詢,當我輸入不匹配的日期時出現此錯誤。例如,如果我的日期範圍是2014年1月1日 - 2014年3月1日,它工作正常。如果我將日期範圍更改爲2014年1月31日 - 2014年2月28日我收到此錯誤。只要天數是相同的數字,它就可以工作。我完全難倒了。有任何想法嗎?下面是我使用的查詢:此表達式輸入不正確,或者太複雜,無法評估....訪問2003年問題
PARAMETERS [START DATE] DateTime, [END DATE] DateTime;
SELECT DISTINCT VEHICLE.VID, VEHICLE.VLOCATION, FUELTRAN.TRANDATE,
(SELECT FUELTRAN.ODOMETER
FROM FUELTRAN
WHERE VEHICLE.VID = FUELTRAN.VID
AND (TRANDATE BETWEEN [START DATE] AND [END DATE])
AND TRANID = (SELECT MAX(TRANID)
FROM FUELTRAN
WHERE VEHICLE.VID = FUELTRAN.VID
AND (TRANDATE BETWEEN [START DATE] AND [END DATE])
AND FUELTRAN.ODOMETER > 0)) AS CURRENTODOM,
(SELECT FUELTRAN.ODOMETER
FROM FUELTRAN
WHERE VEHICLE.VID = FUELTRAN.VID
AND (TRANDATE BETWEEN [START DATE] AND [END DATE])
AND TRANID = (SELECT MIN(TRANID)
FROM FUELTRAN
WHERE VEHICLE.VID = FUELTRAN.VID
AND (TRANDATE BETWEEN [START DATE] AND [END DATE])
AND FUELTRAN.ODOMETER > 0)) AS INITIALODOM,
(SELECT SUM(FUELTRAN.GALLONS)
FROM FUELTRAN
WHERE FUELTRAN.VID = VEHICLE.VID
AND (TRANDATE BETWEEN [START DATE] AND [END DATE])) AS TOTALGALLONS,
((CURRENTODOM-INITIALODOM)/TOTALGALLONS) AS MPG
FROM VEHICLE, FUELTRAN
WHERE VEHICLE.VID=FUELTRAN.VID And TRANDATE=[END DATE] And (VEHICLE.VTYPE="STRAIGHT TRUCK" Or VEHICLE.VTYPE="TRACTOR")
ORDER BY VEHICLE.VLOCATION, VEHICLE.VID, FUELTRAN.TRANDATE;