Re: Delete Question

Поиск
Список
Период
Сортировка
От Pandurangan R S
Тема Re: Delete Question
Дата
Msg-id 5e744e3d0512062355w2f059624v33ef967b858527fe@mail.gmail.com
обсуждение исходный текст
Ответ на Delete Question  (Alex <alex@meerkatsoft.com>)
Список pgsql-general
DELECT FROM table
WHERE (ProdID,ChangeDate) not in
(SELECT ProdID,MAX(ChangeDate) FROM table
 GROUP BY ProdID)

I hope this works.

On 12/7/05, Alex <alex@meerkatsoft.com> wrote:
> Hi,
>
> I have a table where I store changes made to an order. The looks like
> ProdID, ChangeDate, Change1, Change2, ... etc.
> Some ProdIDs have multiple records.
>
> Is there an easy way to delete all records of a ProdID except the most
> recent (ChangeDate is timestamp) one? Preferably in one SQL statement?
>
> Thanks for any advise
>
> Alex
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
>


--
Regards
Pandu

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

Предыдущее
От: Alex
Дата:
Сообщение: Re: Delete Question
Следующее
От: "A.j. Langereis"
Дата:
Сообщение: Re: Delete Question