ella
02-22-2002, 03:24 AM
i'm creating a system wherein i would like to count the number of clients each agent has. i'd like the query to count the primary key to determine this. how do i go about it? help!
|
View Full Version : count total no, of records ella 02-22-2002, 03:24 AM i'm creating a system wherein i would like to count the number of clients each agent has. i'd like the query to count the primary key to determine this. how do i go about it? help! Jerry Stoner 02-22-2002, 05:39 AM Create query, click Totals icon. In the PK column total by Count. David R 02-22-2002, 07:41 AM You'll probably want to have two fields in your query (it can be the PK twice as far as I know). One to Group By, the other to Count. Pat Hartman 02-22-2002, 06:27 PM Select Agent, Count(*) as CountOfClients From tblClient Group by Agent; ella 02-23-2002, 05:51 PM hi jerry and david, thanks for your suggestions. i've tried doing your tips. however, my primary key is the client number that's why when i try to count them in the query, it counts the number of client numbers. do you suggest i create an agent number as well for this to work? help! thanks so much! ella 02-23-2002, 05:52 PM hi pathartman, where shall i paste the code you've created? sorry this is the first time i'll be doing this. thanks so much, ella David R 02-25-2002, 02:32 PM Pat's answer is the SQL version of the query. If you are in Query Design View and click on the Design/View/SQL button at the (usually) far left of your menu, you'll see something similar. It's a more flexible way to design queries. David R Pat Hartman 02-25-2002, 05:38 PM You will however, need to translate my example into your own table and column names. |