dbTalk Databases Forums  

Getting a total for yes/no fields

comp.database.ms-access comp.database.ms-access


Discuss Getting a total for yes/no fields in the comp.database.ms-access forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Paul Danaher
 
Posts: n/a

Default Getting a total for yes/no fields - 06-13-2007 , 01:39 PM






I can use the sum function in a query to get the total number of "yes"
entries in a table, but I finish up with a negative number. I've tried
working with the ABS function in an expression, without success.
Is there an easy answer, please?

Reply With Quote
  #2  
Old   
Ken Snell
 
Posts: n/a

Default Re: Getting a total for yes/no fields - 06-15-2007 , 10:30 PM






This query will do what you seek:

SELECT Abs(Sum(YesNoFieldName)) AS YesCount
FROM TableName;

--

Ken Snell
<MS ACCESS MVP>



"Paul Danaher" <paul.danaher (AT) watwinc (DOT) com> wrote

Quote:
I can use the sum function in a query to get the total number of "yes"
entries in a table, but I finish up with a negative number. I've tried
working with the ABS function in an expression, without success.
Is there an easy answer, please?



Reply With Quote
  #3  
Old   
Paul Danaher
 
Posts: n/a

Default Re: Getting a total for yes/no fields - 06-16-2007 , 09:33 AM



Ken Snell wrote:
Quote:
This query will do what you seek:

SELECT Abs(Sum(YesNoFieldName)) AS YesCount
FROM TableName;

Thanks, that works. And the moral is - learn SQL.


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.