简体   繁体   中英

SQL syntax error in query expression

Im trying to run this query

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

I want to list the customer id and the total number of orders placed for every customer that has more than 2 orders.

I get the syntax error on this line

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

is it because of the 2?s

I'm not familiar with ms-access syntax, but this is how you would do that in regular sql:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM