SQL Server 2008: delete duplicate rows

后端 未结 6 896
北荒
北荒 2020-12-13 11:29

I have duplicate rows in my table, how can I delete them based on a single column\'s value?

Eg

uniqueid, col2, col3 ...
1, john, simpson
2, sally, ro         


        
6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-13 12:00

    DELETE FROM table WHERE uniqueid='1' AND col2='john' Or you change col2='john' to col2='johnny'. Depends on which record you want to delete.

    How did you end up with two same "unique" IDs in the first place?

提交回复
热议问题