Re: Counting unique rows as an aggregate.

Поиск
Список
Период
Сортировка
От r_musta
Тема Re: Counting unique rows as an aggregate.
Дата
Msg-id 5d397b73-372d-4bb1-9318-09211f30cc46@m73g2000hsh.googlegroups.com
обсуждение исходный текст
Ответ на Counting unique rows as an aggregate.  (r_musta <zepolen@gmail.com>)
Ответы Re: Counting unique rows as an aggregate.  (Jan Otto <asche@me.com>)
Re: Counting unique rows as an aggregate.  (Lennin Caro <lennin.caro@yahoo.com>)
Список pgsql-general
On Sep 30, 2:36 am, t...@sss.pgh.pa.us (Tom Lane) wrote:
> > 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<;

I didn't explain well, I want the count of each distinct value in a
column, eg, if the color column has 50 rows, 20x'red', 10x'green',
20x'blue' - it will give me those results.

SELECT count(distinct color) would return 3 - which is the count of
distinct values, which is not what I want.

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

Предыдущее
От: john.crawford@sirsidynix.com
Дата:
Сообщение: Re: database question
Следующее
От: r_musta
Дата:
Сообщение: Re: Counting unique rows as an aggregate.