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!

Remove duplicates

Status
Not open for further replies.

MeganP

Programmer
Sep 23, 2004
18
US
I know the SQL (in Oracle) for removing duplicates (leaves one record). Can some one translate the below or write new one in T-SQL?

delete from my_table t1
where exists (select 'x' from my_table t2
where t2.key_value1 = t1.key_value1
and t2.key_value2 = t1.key_value2
and t2.rowid > t1.rowid);

Thanks!
 
Please check the FAQs before you post....there is a FAQ on handling Duplicates that might help you.

FAQ183-2682

-SQLBill


Posting advice: FAQ481-4875
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top