SELECT SHEET1.CONSIGNEE, SUM(SHEET1.TEU) AS TEU, SHEET1.TRADE, SHEET1.[P/C]
FROM (SELECT *
FROM SHEET1
WHERE SHEET1.[P/C] = 'C' and SHEET1.TRADE='AEX'
ORDER BY SHEET1.CONSIGNEE DESC)
GROUP BY SHEET1.CONSIGNEE, SHEET1.TRADE, SHEET1.[P/C]
ORDER BY SUM(SHEET1.TEU) DESC;
第一次编译ok,但是,第二次就不行了,总是出现错误提示,如下:
Invalid bracketing of name'SELECT *
FROM SHEET1
WHERE SHEET1.[P/C'
我查了一下语句,发现,系统自动加了些东西,如下:
SELECT SHEET1.CONSIGNEE, SUM(SHEET1.TEU) AS TEU, SHEET1.TRADE, SHEET1.[P/C]
FROM [SELECT *
FROM SHEET1
WHERE SHEET1.[P/C] = 'C' and SHEET1.TRADE='AEX'
ORDER BY SHEET1.CONSIGNEE DESC]. AS [%$##@_Alias]GROUP BY SHEET1.CONSIGNEE, SHEET1.TRADE, SHEET1.[P/C]
ORDER BY SUM(SHEET1.TEU) DESC;