Re:

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re:
Дата
Msg-id 4307.1138722490@sss.pgh.pa.us
обсуждение исходный текст
Ответ на ...  ("Gan Uesli Starling" <alias@starling.us>)
Список pgsql-novice
"Gan Uesli Starling" <alias@starling.us> writes:
> I am trying to figure out how to winnow out in a single query (no
> intermediate
> tables) the most recent event for each sensor which has been 'Calibrated' or
> 'Repaired' not 'Damaged' afterwards.

I think you can probably do this with SELECT DISTINCT ON (look at the
"weather reports" example in the SELECT reference page).  DISTINCT ON
is nonstandard, but the bog-standard ways to do this involve messy,
inefficient sub-SELECT constructions.

            regards, tom lane

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

Предыдущее
От: Murat Tasan
Дата:
Сообщение: function returning a setof a column type
Следующее
От: Tom Lane
Дата:
Сообщение: Re: function returning a setof a column type