[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2010-01-06
3
Medium Priority
?
210 Views
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.
0
Comment
Question by:PorterConsultingLLC
  • 2
3 Comments
 
LVL 14

Accepted Solution

by:
Emes earned 1500 total points
ID: 26193281
select count(client),Count(seller),Seller,Client
from table
group by client, Seller
0
 

Author Comment

by:PorterConsultingLLC
ID: 26193684
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!!
0
 

Author Closing Comment

by:PorterConsultingLLC
ID: 31673639
A slight change to the coding to fit my needs gave me exactly what I needed.  THANK YOU!!
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

873 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