Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

removing duplicate entries

Status
Not open for further replies.

keak

Programmer
Sep 12, 2005
247
CA
Hi there,
I have a database where there are are records that have the same first_name and last_name (some of the names have 3 4 duplicates).

Is there a good way to delete the duplicates through pgadmin3 or a SQL statement for this situation?

Any input will be great! :)
 
Try something like this...


delete FROM public.testtable
where id not in
(select min(id) from public.testtable
group by firstname, lastname);


Gary
gwinn7
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top