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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Counting Number values

Status
Not open for further replies.

czarjosh

Technical User
Jul 14, 2002
79
0
0
US
I am collecting data in a field from an option box. How do I count the totals of any certain value. I am trying to use the query below, but it is giving me odd results.


SELECT [Wd] & " - " & [PR] AS Precinct, Count(ContactTimes.ContactData) AS CountOfContactData
FROM [DF Voter File] INNER JOIN ContactTimes ON [DF Voter File].[VOTER ID] = ContactTimes.VorerIDref
GROUP BY [Wd] & " - " & [PR]
HAVING (((Count(ContactTimes.ContactData))=3));
 
but it is giving me odd results
can you please post some input sample, actual result and expected result ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
well my output is only two records both with counts of 3. there should be at least 50, records, with counts well over three.

 
Are you sure you give us enough infos so we can help you ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
this is an example of the query before I add the totals rows:

WD PR ContactData
22 1 Bad Contact
22 1 Bad Contact
22 1 Bad Contact
22 1 Bad Contact
22 1 Bad Contact
24 6 Bad Contact
24 6 Bad Contact
24 6 Bad Contact
24 6 Bad Contact
24 6 Bad Contact
24 6 Bad Contact
24 6 Bad Contact
5 2 Bad Contact
5 2 Bad Contact
5 2 Bad Contact
5 2 Bad Contact


*note that 3=Bad Contact* and there are a total of 1157 records.

Now I add the totals row:

SELECT [DF Voter File].WD, [DF Voter File].PR, Count(ContactTimes.ContactData) AS CountOfContactData
FROM [DF Voter File] INNER JOIN ContactTimes ON [DF Voter File].[VOTER ID] = ContactTimes.VorerIDref
GROUP BY [DF Voter File].WD, [DF Voter File].PR
HAVING (((Count(ContactTimes.ContactData))=3));

and the result i get is this:

WD PR CountOfContactData
10 17 3

It is only 1 record.
 
Perhaps you have only one WD,PR pair having 3 same ContactData.
Are you aware that the result you have doesn't corespond with the the input sample you posted ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top