Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / July 2006

Tip: Looking for answers? Try searching our database.

Using count in a query

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
KDes - 23 Jul 2006 14:14 GMT
I have a query with customer name appearing per order number. How would I get
a count of the number of orders per customer so customer name will only
appear once and the total number of orders will appear instead of each
individual order?
KDes
UpRider - 23 Jul 2006 15:50 GMT
Set up a totals query with two tables, your orders table and your customer
table.
Add a join line from the [customerid] in the customer table to the
[customerid] in the orders table.
Add the [customerid] from the orders table to the grid.
Add the [customer name] from the customer table TWICE to the grid.
From the VIEW menu make sure to check Totals.
For one of the [customer name] totals row choose COUNT
For the other two columns choose GROUP BY
Run the query...

hth, UpRider

>I have a query with customer name appearing per order number. How would I
>get
> a count of the number of orders per customer so customer name will only
> appear once and the total number of orders will appear instead of each
> individual order?
> KDes
KDes - 23 Jul 2006 18:23 GMT
I followed your instructions and it worked!!!  Thanks!!!

>Set up a totals query with two tables, your orders table and your customer
>table.
[quoted text clipped - 15 lines]
>> individual order?
>> KDes
David F. Cox - 24 Jul 2006 17:00 GMT
For my education: I had a problem with count once (unresolved), and solved
it using sum.

Should it always give the same result if the tables are linked as suggested,
grouped by customer name and id (in case two names the same), and have the
third field as  Number of orders:1 and Sum that?

David F. Cox

> Set up a totals query with two tables, your orders table and your customer
> table.
[quoted text clipped - 15 lines]
>> individual order?
>> KDes
UpRider - 25 Jul 2006 00:09 GMT
David, sum is for getting a total for a numeric field, like the sum at the
bottom of a spreadsheet column. In your case, you defined a new column with
a value of 1 and summed that. The end result is the same as Count.
UpRider

> For my education: I had a problem with count once (unresolved), and solved
> it using sum.
[quoted text clipped - 24 lines]
>>> individual order?
>>> KDes
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.