[AccessD] Count multiple columns

David McAfee davidmcafee at gmail.com
Tue Dec 4 12:13:06 CST 2012


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