Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count Distinct in query 2

Status
Not open for further replies.

robertsquestion

Technical User
Jul 16, 2003
81
GB
Hi,

I'm using Access 2000 on Windows 2000 and got the following question:
In Table "Sales" I have 2 fields : Customernr and Articlenr. I would like to create a query that displays the unique number of articles per customer.

So suppose I have got the following records in the table:
10 E4500
10 E8800
10 E8800
20 A4512
20 A4512
20 A8966
20 A9970

The result of the query should be:
10 2
20 3

Do you know how to put this in a query? Thanks in advance for your help!

Robert
The Netherlands
 
Select q1.CustomerNr, Count(q1.ArticleNr) as Knt from
(Select Distinct CustomerNr, ArticleNr from Sales) as Q1
Group by q1.CustomerNr
 
select distinct articlenr, count(articlenr) from tbl group by customernr

or something similar to that should work

--------------------
Procrastinate Now!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top