Re: [HACKERS] Counting bool flags in a complex query - Mailing list pgsql-hackers

From Duane Currie
Subject Re: [HACKERS] Counting bool flags in a complex query
Date
Msg-id 199907140849.FAA16054@sandman.acadiau.ca
Whole thread Raw
In response to Counting bool flags in a complex query  (Michael Richards <miker@scifair.acadiau.ca>)
Responses Re: [HACKERS] Counting bool flags in a complex query
List 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


pgsql-hackers by date:

Previous
From: Hannu Krosing
Date:
Subject: Re: [HACKERS] Interesting behaviour !
Next
From: Constantin Teodorescu
Date:
Subject: Re: [HACKERS] Interesting behaviour !