Re: Delete Question
От
hubert depesz lubaczewski
Тема
Re: Delete Question
Дата
Msg-id
9e4684ce0512062327t728e1873pf308f10fcee0406e@mail.gmail.com
Ответ на
Delete Question (Alex)
Список
Дерево обсуждения
Delete Question Alex <alex@meerkatsoft.com>
Re: Delete Question "A. Kretschmer" <andreas.kretschmer@schollglas.com>
MySQL dump go KEY802207 <go@ugnn.ru>
Re: MySQL dump "A. Kretschmer" <andreas.kretschmer@schollglas.com>
Re: Delete Question Michael Glaesemann <grzm@myrealbox.com>
Re: Delete Question Pandurangan R S <pandurangan.r.s@gmail.com>
Re: Delete Question hubert depesz lubaczewski <depesz@gmail.com>
Re: Delete Question Alex <alex@meerkatsoft.com>
On 12/7/05, Alex <alex@meerkatsoft.com> wrote:
delete from table_name where exists (select * from table_name x where x.prodid = table_name.prodid and x.changedate > table_name.changedate);
this should work.
depesz
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?
delete from table_name where exists (select * from table_name x where x.prodid = table_name.prodid and x.changedate > table_name.changedate);
this should work.
depesz
В списке pgsql-general по дате отправления