Link to home
Start Free TrialLog in
Avatar of PorterConsultingLLC
PorterConsultingLLCFlag for United States of America

asked on

In MS Access 2003, how do I create a COUNT query that will GROUP BY 2 criteria?

In MS Access 2003, how do I code a query for a COUNT, grouping through two criteria?  I need to query a set of records to find out how often each client bought from each seller.

e.g.:  I need to ask how many times did each client purchase from each seller.  Any ideas?
The result needs to have CLIENTID, Number of Purchases, SellerID.
ASKER CERTIFIED SOLUTION
Avatar of Emes
Emes
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of PorterConsultingLLC

ASKER

I do not need to know how many sellers there are, only how many sales each seller made to each client and who the sellers were.  I took your comment and wrote the following:

SELECT COUNT Sales, Seller, Client
FROM Table
GROUP BY SELLER, CLIENT
ORDER BY CLIENT;

and got exactly what I needed.

THANK YOU!!
A slight change to the coding to fit my needs gave me exactly what I needed.  THANK YOU!!