Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 removing duplicate rows from table

Author  Topic 

avijit_mca
Posting Yak Master

109 Posts

Posted - 2010-01-04 : 02:37:52
I want to delete duplicate rows from table using single query.
Note : not using #temp

Regards,
avijit

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-01-04 : 02:52:54
[code]DELETE t
FROM (SELECT ROW_NUMBER() OVER (PARTITION BY <your key combination> ORDER BY NEWID()) AS Seq FROM Yourtable)t
WHERE Seq>1

key combination involves the fields that distinguishes duplicates
[/code]
Go to Top of Page
   

- Advertisement -