Re: Finding (and deleting) dupes in relation table

From: CSN <cool_screen_name90001(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Finding (and deleting) dupes in relation table
Date: 2005-09-22 23:35:54
Message-ID: 20050922233554.14458.qmail@web52902.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Nevermind, figured it out:

select distinct on (table1id, table2id) * into temp
from table3;
delete from table3;
insert into table3 select * from temp;

--- CSN <cool_screen_name90001(at)yahoo(dot)com> wrote:

> I have a table that relates id's of two other
> tables:
>
> table1id, table2id
>
> Dupes have found their way into it (create unique
> index across both fields fails). Is there a quick
> and
> easy way to find and delete the dupes (there are
> tens
> of thousands of records)?
>
> Thanks,
> CSN
>
>
>
> __________________________________
> Yahoo! Mail - PC Magazine Editors' Choice 2005
> http://mail.yahoo.com
>


__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com

Browse pgsql-general by date

  From Date Subject
Next Message vishal saberwal 2005-09-23 00:28:58 Re: Getting the amount of overlap when using OVERLAPS
Previous Message vishal saberwal 2005-09-22 22:40:00 Re: returning the primary key value