Count distinct with SQL

A

Anders Nielsen

Hi NG :)

According to the best of my knowledge this should work fine:

SELECT COUNT (DISTINCT name) FROM MyTable

But it doesn't...

What is wrong??
And even more interesting: Is there another way to count the number of
distinct names??

Any help will be much appreciated :)

Best regards
Anders
 
M

Michel Walsh

Hi,


SELECT COUNT(*) FROM ( SELECT DISTINCT name FROM myTable)


should do, in Jet.


Hoping it may help,
Vanderghast, Access MVP
 
A

Anders Nielsen

Hi Michel :)

Thank you very much :)

Actually, I figured it out by my self before I saw your post.... But who
will believe that now?? ;-)

best regards
Anders
 
Top