Re: SQL Question

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: SQL Question
Дата
Msg-id 425FC495.9050203@archonet.com
обсуждение исходный текст
Ответ на Re: SQL Question  ("GIROIRE, Nicolas (COFRAMI)" <nicolas.giroire@airbus.com>)
Список pgsql-general
GIROIRE, Nicolas (COFRAMI) wrote:
> For the first request (How can i select only the newest record for each ProdId ?), you can do :
>
> select * from test."tableProd" u
>     where u."LastUpdate" = (select max(t."LastUpdate")
>                     from test."tableProd" t
>                     where u."ProdId" = t."ProdId")

Although this only guarantees one row if LastUpdate is unique for every
ProdId.
--
   Richard Huxton
   Archonet Ltd

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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: If statements on select
Следующее
От: "GIROIRE, Nicolas (COFRAMI)"
Дата:
Сообщение: Re: SQL Question