How can I delete duplicate rows in a table

后端 未结 13 1396
情歌与酒
情歌与酒 2020-12-08 22:30

I have a table with say 3 columns. There\'s no primary key so there can be duplicate rows. I need to just keep one and delete the others. Any idea how to do this is Sql Serv

13条回答
  •  无人及你
    2020-12-08 23:13

    How about:

    select distinct * into #t from duplicates_tbl
    
    truncate duplicates_tbl
    
    insert duplicates_tbl select * from #t
    
    drop table #t
    

提交回复
热议问题