Re: Feature Request, aggregate functions distinct on

Поиск
Список
Период
Сортировка
От Rob Sargent
Тема Re: Feature Request, aggregate functions distinct on
Дата
Msg-id 4DB74E4C.3020704@gmail.com
обсуждение исходный текст
Ответ на Re: Feature Request, aggregate functions distinct on  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general

On 04/26/2011 04:33 PM, Tom Lane wrote:
> luda posch<ludaludaluda@gmail.com>  writes:
>> I am not an expert on the official sql spec, but I think it would be useful
>> if distinct on() could be used within an aggregate when supplied with
>> another column name.  For example:
>
>> select sum(distinct on(id) order_price) from order_table;
>> select sum(distinct on(email_address) bounce_count) from email_bounces;
>> select sum(distinct on(county) area) from state_county_area;
>
> Use another level of sub-select, eg
>
> select sum(order_price) from
>    (select distinct on(id) order_price from order_table ...) ss;
>
> The usefulness of this doesn't really seem high enough to justify
> inventing and maintaining a more compact way to handle it.
>
>             regards, tom lane
>
I thing OP was hoping for tuples of email, bounceCount. I don't read
your sub-select as providing this?

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Feature Request, aggregate functions distinct on
Следующее
От: Toby Corkindale
Дата:
Сообщение: Re: Poor performance of btrfs with Postgresql