[AccessD] Count multiple columns

Salakhetdinov Shamil mcp2004 at mail.ru
Tue Dec 4 08:24:39 CST 2012


Hi John --

Try 

Count(ISNULL([YourColumnName],0)

Thank you.

-- Shamil


Вторник,  4 декабря 2012, 9:09  от jwcolby <jwcolby at colbyconsulting.com>:
>	
>
>
	
	
>
		
		
			
>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
>

>
-- 
>
AccessD mailing list
>
>AccessD at databaseadvisors.com
>
>http://databaseadvisors.com/mailman/listinfo/accessd
>
Website: http://www.databaseadvisors.com
>
>			
		
		
	

	
>



More information about the AccessD mailing list