求SQL语句

LamLam 2001-12-14 01:19:04
求SQL语句
删除TABLE里面相同的多余记录
只保留唯一一条
比如
1,A
1,A
1,A
2,B

删除两个多余相同的1,A
最后保留
1,A
2,B
谢谢!!
...全文
58 5 打赏 收藏 举报
写回复
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
LamLam 2001-12-14
  • 打赏
  • 举报
回复
谢谢大家!! :)
panther_totem 2001-12-14
  • 打赏
  • 举报
回复
强烈建议:用guasha(刮痧)的
select distinct * into #temp from table

delete table

insert into table select * from #temp
panther_totem 2001-12-14
  • 打赏
  • 举报
回复
我还写错了:
select distinct * into table2 from table1;
delete table1;
insert into table1 select * from table2;
drop table table2;


panther_totem 2001-12-14
  • 打赏
  • 举报
回复
select distinct * into table2 from table1;
drop table table1;
select * into table1 from table2;
drop table table2;

最老土的办法。
guasha 2001-12-14
  • 打赏
  • 举报
回复

select distinct ??
into #temp
from table

delete table

insert into table
select * from #temp
发帖
MS-SQL Server

3.4w+

社区成员

MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
帖子事件
创建了帖子
2001-12-14 01:19
社区公告
暂无公告