removing duplicates - sql

From: "Johnson, Shaunn" <SJohnson6(at)bcbsm(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: removing duplicates - sql
Date: 2002-08-21 23:52:01
Message-ID: 73309C2FDD95D11192E60008C7B1D5BB04C73E56@snt452.corp.bcbsm.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Howdy:

I have a table that has a primary key on it. Somewhere in
the table, it seems to have a few duplicate records in it.
I'm trying to weed out the duplicates, but am having problems
with the sql.

To start, I create a temp table and just get the
distinct records I need.

[code]
select distinct
name,
addr1,
phone,
city
into temp_table
from emp_table ;
[/snip code]

I see by the count of the two tables there are
about 50 or so records that are in one and
not in the temp_table. How do I use the
where clause to figure out where the duplicates
are?

Suggestions? TIA!

-X

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ray Hunter 2002-08-22 00:43:07 Primary Keys
Previous Message Darren Ferguson 2002-08-21 22:27:17 Re: Can't get postgresql to work