Count the Distinct items

shevo

Registered User.
Local time
Today, 11:44
Joined
Jun 3, 2007
Messages
16
Hello all,
I am new to this forum. I have this problem where I need to sort the 4 books in the tables below according to the highest quantity of book sold.In this scenario,
Book C would be 1st in the table with a total quantity of 8.
How do I write a query in access to perform such operation. I have to use DISTINCT to get each book and also count the quantity(e.g. Book C:5+8).
But it seems that I can't use Count and distinct together in Access.

Title SalesNo Quantity
BookA 2 2
BookB 3 1
BookC 4 5
BookC 5 3
BookD 6 1

Hope u all can help!
 
What is SalesNo? If you get rid of that, you should be able to do it.
 
What is SalesNo? If you get rid of that, you should be able to do it.

Ok lets say now

Title Quantity
BookA 2
BookB 1
BookC 5
BookC 3
BookD 1

How do I get
BookA 2
BookB 1
BookC 8
BookD 1
 
In the QBE (query by example grid) if you select the group by button (greek sigma sign) it will say GroupBy in all of the fields, then select SUM on the Quantity field and leave GroupBy in the Title.
 

Users who are viewing this thread

Back
Top Bottom