Counting a yes/no field

G

Guest

OK I'm brain dead on this Friday. I want the query to count the number of
yes entries in three field, independantly. Right now I get (for two records)
2 in each field even though I have 2 entries in field one, 1 in field two and
0 in field three.

Desired results:

EX. a count of entries
field 1 10
field 2 3
field 3 5

SELECT [IntraDay Mgmt - Table].Contact, Count([IntraDay Mgmt - Table].Email)
AS CountOfEmail, Count([IntraDay Mgmt - Table].Pager) AS CountOfPager,
Count([IntraDay Mgmt - Table].Phone) AS CountOfPhone
FROM [IntraDay Mgmt - Table]
WHERE ((([IntraDay Mgmt - Table].Date) Between [Enter Starting Date] And
[Enter Ending Date]))
GROUP BY [IntraDay Mgmt - Table].Contact;
 
D

Duane Hookom

Count() will count yes and no exactly the same. You probably need to use an
expression like:

SELECT Sum(Abs(YourField)) as NumYourFieldYes, ...
FROM tblYourTable
GROUP BY...;
 
G

Guest

Great, that's it

Duane Hookom said:
Count() will count yes and no exactly the same. You probably need to use an
expression like:

SELECT Sum(Abs(YourField)) as NumYourFieldYes, ...
FROM tblYourTable
GROUP BY...;

--
Duane Hookom
MS Access MVP

RA said:
OK I'm brain dead on this Friday. I want the query to count the number of
yes entries in three field, independantly. Right now I get (for two
records)
2 in each field even though I have 2 entries in field one, 1 in field two
and
0 in field three.

Desired results:

EX. a count of entries
field 1 10
field 2 3
field 3 5

SELECT [IntraDay Mgmt - Table].Contact, Count([IntraDay Mgmt -
Table].Email)
AS CountOfEmail, Count([IntraDay Mgmt - Table].Pager) AS CountOfPager,
Count([IntraDay Mgmt - Table].Phone) AS CountOfPhone
FROM [IntraDay Mgmt - Table]
WHERE ((([IntraDay Mgmt - Table].Date) Between [Enter Starting Date] And
[Enter Ending Date]))
GROUP BY [IntraDay Mgmt - Table].Contact;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top