Re: Picking out the most recent row using a time stamp column

Поиск
Список
Период
Сортировка
От Michael Glaesemann
Тема Re: Picking out the most recent row using a time stamp column
Дата
Msg-id 08B3368E-E623-4E9C-83F5-AB05B471AF4C@seespotcode.net
обсуждение исходный текст
Ответ на Picking out the most recent row using a time stamp column  (Dave Crooke <dcrooke@gmail.com>)
Ответы Re: Picking out the most recent row using a time stamp column  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Список pgsql-performance
On Feb 24, 2011, at 14:55, Dave Crooke wrote:

> Is there a more elegant way to write this, perhaps using PG-specific
> extensions?

SELECT DISTINCT ON (data.id_key)
       data.id_key, data.time_stamp, data.value
  FROM data
  ORDER BY data.id_key, data.time_stamp DESC;

Michael Glaesemann
grzm seespotcode net




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

Предыдущее
От: "Kevin Grittner"
Дата:
Сообщение: Re: Picking out the most recent row using a time stamp column
Следующее
От: "Kevin Grittner"
Дата:
Сообщение: Re: Picking out the most recent row using a time stamp column