error. help. :(

  • Thread starter Thread starter Tracy
  • Start date Start date
T

Tracy

i tried to run a query in access 2003:
SELECT COUNT(DISTINCT patservices.patientkey) FROM patservices;
I received syntax error (missing operator) in query expression
'COUNT(DISTINCT patservices.patientkey) '
Then i tried
SELECT COUNT(DISTINCT (PATSERVICES.PATIENTKEY))
FROM PATSERVICES;
I received:Undefined function 'DISTINCT' in expression.

what did i do wrong? thanks alot!
 
i tried to run a query in access 2003:
SELECT COUNT(DISTINCT patservices.patientkey) FROM patservices;
I received syntax error (missing operator) in query expression
'COUNT(DISTINCT patservices.patientkey) '
Then i tried
SELECT COUNT(DISTINCT (PATSERVICES.PATIENTKEY))
FROM PATSERVICES;
I received:Undefined function 'DISTINCT' in expression.

what did i do wrong? thanks alot!

You just assumed that ACCESS SQL is ANSI compliant. It's not. In
particular, the COUNT (DISTINCT... operation is not supported in
Access.

You'll need to use a Subquery:

SELECT Count(*) FROM(SELECT DISTINCT patservices.patientkey FROM
patservices);

John W. Vinson[MVP]
 
supper! Thanks alot.
John Vinson said:
You just assumed that ACCESS SQL is ANSI compliant. It's not. In
particular, the COUNT (DISTINCT... operation is not supported in
Access.

You'll need to use a Subquery:

SELECT Count(*) FROM(SELECT DISTINCT patservices.patientkey FROM
patservices);

John W. Vinson[MVP]
 
supper! Thanks alot.

Glad it helped. And I just had supper (eggplant and green pepper
marinara sauce on capellini, with Parmesean and Romano cheese)...

John W. Vinson[MVP]
 
sounds yummy - must try it sometime

John Vinson said:
Glad it helped. And I just had supper (eggplant and green pepper
marinara sauce on capellini, with Parmesean and Romano cheese)...

John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

count question 3
error in query 2
Access Query help needed 1
Inconsistent working of SQL 1
A Real Stumper 3
'Not Equal to' 1
Help with Select statement 6
How to do this in Access 4

Back
Top