Re: Bringing other columns along with a GROUP BY clause

Поиск
Список
Период
Сортировка
От Gregory Stark
Тема Re: Bringing other columns along with a GROUP BY clause
Дата
Msg-id 87skmslbtg.fsf@oxford.xeocode.com
обсуждение исходный текст
Ответ на Re: Bringing other columns along with a GROUP BY clause  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Tom Lane <tgl@sss.pgh.pa.us> writes:

> I have a feeling that it could also be done via the "window functions"
> feature due to be introduced in 8.4, but I'm not entirely sure how.
> Anybody feeling handy with those?

There may be a better way but something like

select * from (select *, rank() over (partition by charge order by coldspot_time desc) as r) where r = 1

?


--
  Gregory Stark
  EnterpriseDB          http://www.enterprisedb.com
  Ask me about EnterpriseDB's 24x7 Postgres support!

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

Предыдущее
От: Erik Jones
Дата:
Сообщение: Re: Pet Peeves?
Следующее
От: Kusuma Pabba
Дата:
Сообщение: small doubt