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

Поиск
Список
Период
Сортировка
От Duane Currie
Тема Re: [HACKERS] Counting bool flags in a complex query
Дата
Msg-id 199907140849.FAA16054@sandman.acadiau.ca
обсуждение исходный текст
Ответ на Counting bool flags in a complex query  (Michael Richards <miker@scifair.acadiau.ca>)
Ответы Re: [HACKERS] Counting bool flags in a complex query  (Michael Richards <miker@scifair.acadiau.ca>)
Список 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 по дате отправления:

Предыдущее
От: Hannu Krosing
Дата:
Сообщение: Re: [HACKERS] Interesting behaviour !
Следующее
От: Constantin Teodorescu
Дата:
Сообщение: Re: [HACKERS] Interesting behaviour !