Re: [HACKERS] Counting bool flags in a complex query

From: Duane Currie <dcurrie(at)sandman(dot)acadiau(dot)ca>
To: miker(at)scifair(dot)acadiau(dot)ca (Michael Richards)
Cc: pgsql-hackers(at)hub(dot)org
Subject: Re: [HACKERS] Counting bool flags in a complex query
Date: 1999-07-14 08:49:51
Message-ID: 199907140849.FAA16054@sandman.acadiau.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Hi.
>
> I think I've created a monster...
>
...
>
> My final problem is to count all the messages with flagnew set to true.
> The only way I can think to do this is to convert the bool value to a 1 or
> 0 (which I think should be a standard conversion anyway) and run a sum()
> on them.
>
> Unless anyone can come up with a better way to do this, What is the best
> way to implement a conversion from bool to int?
>
> -Michael

Of course, you could always use count() and a 'WHERE flagnew' clause...

Duane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Uncle George 1999-07-14 10:23:22 RedHat6.0 & Alpha
Previous Message Nuchanach Klinjun 1999-07-14 08:06:34 upgrade problem