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

Posted on 2010-01-06
Last Modified: 2013-11-05
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.
Question by:PorterConsultingLLC
    LVL 14

    Accepted Solution

    select count(client),Count(seller),Seller,Client
    from table
    group by client, Seller

    Author Comment

    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

    and got exactly what I needed.


    Author Closing Comment

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

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
    Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
    With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now