sql server两行数据相同怎么删除一行

2024-12-16 14:52:45
推荐回答(3个)
回答1:

比如你的表名叫aa,bb是临时空表
select distinct * from aa into bb
drop aa
select * from bb into aa
drop bb

回答2:

select distinct * into TB2 from TB1
delete from TB1 where TB1.唯一字段 in (select 唯一字段 from TB2)
INSERT INTO TB1
select * from TB2

回答3:

直接在表中删除去,我汗,怎么会有相同的行呢,你数据库的表没设置主键外键么