Count in queries

pat_nospam

Registered User.
Local time
Today, 23:12
Joined
Oct 14, 2003
Messages
151
I want to count the results of a query for some group by conditions. So I put together a query and try to utilize the "Count" function in Totals, but it counts the total of the numerical value of the ID Primary Key, instead of giving me the total rows returned.

For example,

ID | Date | Value

1 | 2-2-2004 | $14

2 | 2-3-2004 | $15

My query returns the "Count" value as 3 (the sum of rows 1 & 2) rather than telling me it's returned 2 rows.

Any ideas? I'm sure its something simple.

TIA
 
OK, a bit confused here.

You are using the Count function in the "Total:" row under the [ID] column? I don't understand how the Count function is returning the Sum of the IDs. Perhaps it's just ending up as 3 coincidentally.
 
I agree - I was also confused. So, the "Count" function beneath the totals is supposed to return a sum of the rows returned, not the sum of the values within the rows?

Is that right? But what if I identified the following in the query as the criteria.

Field: ID
Table: TableName
Total: Count

Then it is counting the ID totals and summing them, returning values like 40,000 when there are only 10,000 rows in the table..

I can post SQL if it helps?

Thanks again
 
Yes, please post the SQL, and if possible a jpg of the query itself. And write exactly what you'd like the query to return.
 
I fixed it :) Thanks for the assist
 
Last edited:

Users who are viewing this thread

Back
Top Bottom