Counting unique values and all values in same query

  • Thread starter Thread starter John Morrissey
  • Start date Start date
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.
 
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
 
Back
Top