Re: highest match in group

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: highest match in group
Дата
Msg-id 6954.1071074231@sss.pgh.pa.us
обсуждение исходный текст
Ответ на highest match in group  ("Dave [Hawk-Systems]" <dave@hawk-systems.com>)
Ответы Re: highest match in group
Список pgsql-general
"Dave [Hawk-Systems]" <dave@hawk-systems.com> writes:
> have a data table that records entries by date(unix timestamp) and customer
> number.  each custnum will have several entries showing a running ledger type
> snapshot.  we have the need to get the most recent entry from not one, but all
> unique customers, in the most cost effective manner.

If you don't mind using a Postgres-only construct, SELECT DISTINCT ON
is made for this.  See the "weather report" example in the SELECT
reference page.

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Strange permission problem regarding pg_settings
Следующее
От: "John Sidney-Woollett"
Дата:
Сообщение: Update multiple columns with select statement?