Re: Re: Need help with what I think is likely a simple query - for each distinct val, return only one record with the most recent date.

Поиск
Список
Период
Сортировка
От Reid Thompson
Тема Re: Re: Need help with what I think is likely a simple query - for each distinct val, return only one record with the most recent date.
Дата
Msg-id 1315930434.11095.108.camel@raker.ateb.com
обсуждение исходный текст
Ответ на Re: Re: Need help with what I think is likely a simple query - for each distinct val, return only one record with the most recent date.  (Hannes Erven <hannes@erven.at>)
Ответы Re: Re: Need help with what I think is likely a simple query - for each distinct val, return only one record with the most recent date.
Список pgsql-general
On Tue, 2011-09-13 at 16:39 +0200, Hannes Erven wrote:
> Reid,
>
>
> > where any one of these 3
> >
> > 1    1       2011-01-01
> > 1    1       2011-01-01
> > 1    3       2011-01-01
> >
> > or any one of these 2
> > 3    1       2011-01-05
> > 3    2       2011-01-05
> >
> > are suitable for val = 1, val = 3 respectively.
>
>
> Can you please describe in words what you are trying to accomplish? When
> I look at your data and expected output, I'd say you want this:
>
>    For each distinct value of "val1", return any value of "val2" and
>    the lowest value of "date".

for each distinct value of "val1', return the highest value(most recent)
of "date" and the value of "val2" associated with that date




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

Предыдущее
От: Merlin Moncure
Дата:
Сообщение: Re: PostgreSQL 9.1, replica and unlogged tables
Следующее
От: John R Pierce
Дата:
Сообщение: Re: Has Pg 9.1.0 been released today?