Home » SQL & PL/SQL » SQL & PL/SQL » remove duplicate records
remove duplicate records [message #187233] Fri, 11 August 2006 07:27 Go to next message
bibber
Messages: 38
Registered: August 2006
Member
Hi, I have a table containing duplicate records (no primary key defined...); every attribute has the same value. Is there a SQL statement possible to keep one record and remove the duplicates?
Re: remove duplicate records [message #187234 is a reply to message #187233] Fri, 11 August 2006 07:40 Go to previous messageGo to next message
joy_division
Messages: 4768
Registered: February 2005
Location: East Coast USA
Senior Member
You don't need a PK. Just know what the unique key is and use that as your search criteria. Search the board for removing duplicates. If it's all the columns, then so be it. There are hundreds of posts about how to do it.
icon14.gif  Re: remove duplicate records [message #187235 is a reply to message #187233] Fri, 11 August 2006 07:40 Go to previous messageGo to next message
amul
Messages: 252
Registered: April 2001
Location: Chennai
Senior Member
delete 
from emp e 
where e.rowid>(select min(b.rowid) from emp b where e.empno=b.empno)

Re: remove duplicate records [message #187237 is a reply to message #187235] Fri, 11 August 2006 07:41 Go to previous messageGo to next message
amul
Messages: 252
Registered: April 2001
Location: Chennai
Senior Member
and for gods sake dont post duplicates
Re: remove duplicate records [message #187238 is a reply to message #187237] Fri, 11 August 2006 07:44 Go to previous message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Removed duplicate posts.
See, it isn't that hard to remove duplicates Wink
Previous Topic: Tuning a Plsql procedure
Next Topic: Composite index usage
Goto Forum:
  


Current Time: Tue Aug 22 15:49:54 CDT 2017

Total time taken to generate the page: 0.09649 seconds