Access Count Distinct with Grouping

kimosavi

Registered User.
Local time
Yesterday, 19:41
Joined
Jan 11, 2009
Messages
16
Hi. I know this question has been around for quite some time but I don't seem to find the correct syntax for my query.

I have a table with 3 fields: Bucket, Vendors, Docs.

I want to run a query that tells me how many unique vendors and docs are in each Bucket

Bucket Vendor# Doc#
CAT1 10 50
CAT2 12 30


let me know if someone can give me a hand please....

Thanks!
 
Try this:

SELECT Bucket, Count([Vendor#]) as VendorCount , Count([Doc#]) as DocCount FROM table1
GROUP BY Bucket
 
It occured to me today that I didn't think this through. Maybe this would work:

SELECT Bucket, Count([Vendor#]) as VendorCount FROM table1
GROUP BY Bucket, [Vendor#]

I think you would need a second query for docs:

SELECT Bucket, Count([Doc#]) as DocCount FROM table1
GROUP BY Bucket, [Doc#]
 

Users who are viewing this thread

Back
Top Bottom