Re: Do I just not understand count()?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Do I just not understand count()?
Дата
Msg-id 22875.1018294241@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Do I just not understand count()?  ("Gregory Wood" <gregw@com-stock.com>)
Список pgsql-general
"Gregory Wood" <gregw@com-stock.com> writes:
> I'm not sure exactly what it does with "a=1" though... I'm
> guessing that it returns a boolean value, which means that it counts as a
> row (only NULL values are not counted in count()).

Yup, Greg gets a gold star: COUNT *only* cares whether its input is NULL
or not, not what specific value it might have.  This is per SQL spec.

The nearby suggestions involving SUM() look like they would work to
accumulate counts of different conditions in a single pass.

            regards, tom lane

В списке pgsql-general по дате отправления:

Предыдущее
От: Michael Adler
Дата:
Сообщение: Re: inherited columns as foreign keys WAS "no subject"
Следующее
От: Tom Lane
Дата:
Сообщение: Re: vacuuming not working?