Re: multi-column aggregates

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: multi-column aggregates
Дата
Msg-id b42b73150603091118n5b8a64ddu4ffcec1d654fbcca@mail.gmail.com
обсуждение исходный текст
Ответ на Re: multi-column aggregates  (Chris Kratz <chris.kratz@vistashare.com>)
Ответы Re: multi-column aggregates  (Chris Kratz <chris.kratz@vistashare.com>)
Список pgsql-general
Chris Kratz wrote:
> Well for anyone else who may be interested in doing something similar, here is
> what we did.  It does require typecasting going into the functions, composite
> types and using the dot notation to get the value back out of the composite
> object returned.  But it works.
>
> This is what we wanted...
>
> select last(cur_date, some_column) from some_table....
>
> We got this close...
>
> select (last((cur_date, some_column)::last_int_agg)).value as last_int from...

have you looked at new row-wise comparison feature (i might be
misunderstanding your problem)?

select some_column from some_table where (cur_date, some_column) <
'01/01/06',  99999999) order by cur_date desc, some_column desc limit
1;

this will give you the highest value of some_column on the abitrarily
chosen date 01/01/06 (assuming all values of some_column are less than
99999999).

Merlin

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

Предыдущее
От: Chris Kratz
Дата:
Сообщение: Re: multi-column aggregates
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: NULL TIMESTAM problem