[AccessD] Count multiple columns

jwcolby jwcolby at colbyconsulting.com
Tue Dec 4 08:09:24 CST 2012


I am doing counts for a set of columns.  The values in the column are either 1 or 0 signifying true 
or false.  If I just do a count() as xyz all the columns give a count equal to the total number of 
records.  I need to do a count of a value of 1.

I discovered that if I change one of the 0 values to a NULL then the record with Null does not get 
counted.  Thus I could go through the table updating each field which uses this method = null where 
'0'.

Obviously this is a lot of work I would like to avoid.  However it might be faster(?) to do the count?

My preference however is to somehow tell the count() of each column to only count values of '1'.

Is this possible in TSQL?

-- 
John W. Colby
Colby Consulting

Reality is what refuses to go away
when you do not believe in it



More information about the AccessD mailing list