Re: SQL for Deleting all duplicate entries

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: Håkan Jacobsson <hakan(dot)jacobsson99(at)bredband(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: SQL for Deleting all duplicate entries
Date: 2007-09-05 19:30:37
Message-ID: dcc563d10709051230s25c80ab7lff7431c225f7ef49@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 9/5/07, Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com> wrote:
> begin;
> delete from table where uid in (select * from table t1 join table t2
> on (t1.field1=t2.field1 AND t1.field2=t2.field2 AND
> t1.field3=t2.field3 AND t1.uid>t2.uid) );
> (check for dups / lost data)
> commit;

There's a bug up there ^^^

should be:

delete from table where uid in (select t1.uid from...

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2007-09-05 19:39:13 Re: UTF8 frustrations
Previous Message jesse.waters 2007-09-05 19:28:59 Re: UTF8 frustrations