我正在尝试选择 1977 年未订购的 CustomerID:
SELECT CustomerID
FROM orders
EXCEPT
SELECT CustomerID
FROM orders
WHERE YEAR(OrderDate)=1977);
表“订单”同时包含 CustomerID 和 OrderDate
错误是:
Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(SELECT CustomerID FROM orders WHERE YEAR(OrderDate)=1977)' at line 1