Re: Counting unique rows as an aggregate.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Counting unique rows as an aggregate.
Дата
Msg-id 26009.1222731396@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Counting unique rows as an aggregate.  (r_musta <zepolen@gmail.com>)
Ответы Re: Counting unique rows as an aggregate.  ("Richard Broersma" <richard.broersma@gmail.com>)
Список pgsql-general
r_musta <zepolen@gmail.com> writes:
> However, this is starting to become too slow (as there are about 10 of
> these queries), and therefore I need to write an aggregate function
> which lets me do:

> SELECT count_unique(make), count_unique(color) from table WHERE >criteria<;

I must be missing something, because I don't see why you couldn't do

SELECT count(distinct make), count(distinct color) from table WHERE >criteria<;

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: database question
Следующее
От: Mike Diehl
Дата:
Сообщение: Re: Can't cast from char to integer...