Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
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.


In response to


pdxpug by date

Next:From: Thomas J KellerDate: 2006-10-18 22:16:23
Subject: Re: duplicate records
Previous:From: David E. WheelerDate: 2006-10-18 21:39:58
Subject: Re: duplicate records

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group