Syntax Error in Count

  • Thread starter Thread starter mommio2
  • Start date Start date
M

mommio2

Could you please tell me what is wrong with this? I'm a newbie. It says
there is an error on my COUNT. It worked before I put the COUNT and the
parentheses in. THANKS!!!

SELECT COUNT( DISTINCT Customer.id)
FROM Customer INNER JOIN [Order] ON Customer.id=Order.[CUSTOMER$id]
ORDER BY Customer.id;

Mommio2
 
If I remember correctly, you cannot use the Distinct keyword inside a count
statement with JET (but you can with other type of sql-server database).
Could you describe what you want to do/achieve exactly?

--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Email: sylvain2009 sylvainlafontaine com (fill the blanks, no spam please)
Independent consultant and remote programming for Access and SQL-Server
(French)
 
Try this:

SELECT COUNT( * ) FROM
(SELECT DISTINCT Customer.id
FROM Customer INNER JOIN [Order] ON Customer.id=Order.[CUSTOMER$id]
ORDER BY Customer.id);
 
Back
Top