[AccessD] [SPAM] Re: Count multiple columns

jwcolby jwcolby at colbyconsulting.com
Tue Dec 4 13:08:34 CST 2012


It's not a bit field, it is a varchar() '1' or '0'.

I have decided to simply replace the '0' with a null, whereupon Count() works straight up.

John W. Colby
Colby Consulting

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

On 12/4/2012 1:13 PM, David McAfee wrote:
> Now that I am in front of a computer, this works on my bit field:
>
> SELECT Sum(CAST(ShowRecord AS TINYINT)) AS SumOfShow FROM tblLocationKey
> (NOLOCK)
>
> Returns the same (47 records) as this:
> SELECT * FROM tblLocationKey (NOLOCK) WHERE ShowRecord = 1
>
> HTH
> David
>
>
> On Tue, Dec 4, 2012 at 9:01 AM, Charlotte Foust
> <charlotte.foust at gmail.com>wrote:
>
>> Even if it's a text field, just test for IsNumeric and use a sum.  Too much
>> work otherwise.
>>
>> Charlotte
>>
>> On Tue, Dec 4, 2012 at 8:49 AM, Gustav Brock <gustav at cactus.dk> wrote:
>>
>>> Hi Lembit
>>>
>>> So you are still with us? Great!
>>> I hope all is well and your video lab is running smoothly. Not to mention
>>> your beer tab!
>>>
>>> /gustav
>>>
>>>
>>> -----Oprindelig meddelelse-----
>>> Fra: accessd-bounces at databaseadvisors.com
>>> [mailto:accessd-bounces at databaseadvisors.com] På vegne af Lembit Soobik
>>> Sendt: 4. december 2012 15:20
>>> Til: Access Developers discussion and problem solving
>>> Emne: Re: [AccessD] Count multiple columns
>>>
>>> Hi John,
>>> won' a sum give you the count if all to be counted are 1s?
>>>
>>> Lembit
>>>
>>>
>>> --
>>> AccessD mailing list
>>> AccessD at databaseadvisors.com
>>> http://databaseadvisors.com/mailman/listinfo/accessd
>>> Website: http://www.databaseadvisors.com
>>>
>> --
>> 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