CountDistinct group function?

R

razor

Hi,

How can I write a query to Count the distinct values in a
field?

Is there an aggregate function called "CountDistinct()"
that I can use in the totals row?

Thanks!
Razor
 
B

Brian Camire

No, not in Access.

To achieve the same effect, you need two queries -- one to select the
distinct values, and another to count them. In Access 2000 later, you can
make the first a subquery of the second, as in something like:

SELECT COUNT(*)
FROM
(SELECT DISTINCT
[Your Table].[Your Field]
FROM
[Your Table])
 

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

Top