watch this  

the official mrchucho blog

Deleting Duplicates with SQL

Posted 2005 Aug 19
Deleting duplicate data in a database is a very common endeavor, especially when dealing with legacy databases and applications. I found this little gem and wanted to share:
delete from employee
where (rowid, empssn) not in
    (select min(rowid), empssn from employee group by empssn);
It’s simple and generally applicable and - even better - doesn’t require a CURSOR.

Responses to "Deleting Duplicates with SQL"

No responses yet.

Comments are now closed.
atom rss