查询表达式中的SQL语法错误

时间:2013-04-21 21:26:17

标签: sql ms-access syntax

我试图运行此查询

select customerID, sum(OrderID)
from employee_T
where 2 < select(sum(OrderID) from employee_T)
group by customerID;

我想列出客户ID和每个订单超过2个订单的订单总数。

我在这一行得到了语法错误

where 2 < select(sum(OrderID) from employee_T)

是因为2?s

1 个答案:

答案 0 :(得分:3)

我不熟悉ms-access语法,但这是你在常规sql中的方法:

select customerID, count(OrderID)
from employee_T
group by customerID
having count(orderID) > 2