请问如何删除一个表中完全相同的记录?

bestmai 2004-11-05 07:33:40
thx
...全文
147 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
bestmai 2004-11-06
  • 打赏
  • 举报
回复
thx a lot
niuniuma 2004-11-06
  • 打赏
  • 举报
回复
学习.
qijiangyou 2004-11-06
  • 打赏
  • 举报
回复
delete t1 from t1 a
where ( select count(*) from t1 b where a.列1 = b.列1 and a.列2 = b.列2 and ... ) > 1
leech125 2004-11-06
  • 打赏
  • 举报
回复
先计算@count, 然后再删除@count > 1的
csdnshao 2004-11-06
  • 打赏
  • 举报
回复
select distinct * into temp1 from t1

delete from t1

insert into t1 select * from temp1


drop table temp1
xiuxiuzi 2004-11-06
  • 打赏
  • 举报
回复
不知道楼主是否想保留相同记录中的一条?如果保留的话
select distinct * into temp1 from t1

delete from t1

insert into t1 select * from temp1
xingfuniao 2004-11-06
  • 打赏
  • 举报
回复
建立存储过程
create procedure MyP
as
select * into #t
from (select * from 表 union select * from 表) b
delete 表
insert into 表 select * from #t
drop table #t
go
exec MyP
光原 2004-11-06
  • 打赏
  • 举报
回复
1。在企业管理器把表新加一列timesamp类型,
2。再删除那行,
3。接下来删除新加的列(timesamp类)型。
bestmai 2004-11-06
  • 打赏
  • 举报
回复
up

34,873

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧