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.
Author |
Topic |
manibad
Starting Member
9 Posts |
Posted - 2012-10-04 : 16:43:29
|
I have a table named dup and in that i have to columns namely ID and Name.The values in the table are ID Name1 M1 M1 M 1 M1 MMy aim is to delete the duplicated records and keep the distinct record.That is i gotta to delete 4 out of 5 rows and keep the rest.How is this possible?Pls give ur methods and explanations |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-10-04 : 17:02:36
|
yep. do likeDELETE tFROM(SELECT ROW_NUMBER() OVER (PARTITION BY ID,Name ORDER BY ID) AS SeqFROM Table)tWHERE Seq>1 ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|