Counting unique values and all values in same query

J

John Morrissey

I have a select query that is linked to a reference table
containing product names. The tables are linked by a
product code common to both tables; when it matches, the
table link populates the name of the product in the query.

The main table contains data lines by Account Number and
Cost Center fields as follows.
111 000
111 001
111 010
222 000
222 001
222 010

Using a form that is linked to this select query, I want
to count unique values of Account Number (2 instances, not
6) but I also want to count detail values of Cost Center
(6 instances, not 3.
 
M

Michel Walsh

Hi,


SELECT COUNT(*) FROM ( SELECT DISTINCT [Account Number] FROM myTable ) As x


and


SELECT COUNT(*) FROM ( SELECT DISTINCT [Cost Center] FROM myTable ) As x



Hoping it may help,
Vanderghast, Access 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

Top