Re: duplicate records

From: Selena Deckelmann <selena(at)chrisking(dot)com>
To: Thomas J Keller <kellert(at)ohsu(dot)edu>, pdxpug(at)postgresql(dot)org
Subject: Re: duplicate records
Date: 2006-10-18 21:43:17
Message-ID: 47ed9e2ed59c142a86246f08842edc97@chrisking.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pdxpug


On Oct 18, 2006, at 2:23 PM, Thomas J Keller wrote:

> Greetings,
> Is it appropriate to ask an operational question - not necessarily
> unique to postgresql?
>
> I inserted a few hundred records into a new database table and
> discovered that several where duplicates.
> How does one select these (so they can be deleted)?

You could create a temporary table, SELECT DISTINCT from your problem
table, drop the original table, and then move your temp table data into
the original table.

If your primary key has duplicates, you'll need to make your temporary
table a little different than your original table.

-selena

In response to

Responses

Browse pdxpug by date

  From Date Subject
Next Message Thomas J Keller 2006-10-18 22:16:23 Re: duplicate records
Previous Message David E. Wheeler 2006-10-18 21:39:58 Re: duplicate records