user214577
user214577

Reputation: 363

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

Upvotes: 0

Views: 306

Answers (1)

Blorgbeard
Blorgbeard

Reputation: 103535

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

Upvotes: 3

Related Questions