求SQL语句
求SQL语句
删除TABLE里面相同的多余记录
只保留唯一一条
比如
1,A
1,A
1,A
2,B
删除两个多余相同的1,A
最后保留
1,A
2,B
谢谢!!
问题点数:30、回复次数:5Top
1 楼guasha(刮痧)回复于 2001-12-14 13:24:47 得分 20
select distinct ??
into #temp
from table
delete table
insert into table
select * from #tempTop
2 楼panther_totem(青争岁月)回复于 2001-12-14 13:33:15 得分 0
select distinct * into table2 from table1;
drop table table1;
select * into table1 from table2;
drop table table2;
最老土的办法。
Top
3 楼panther_totem(青争岁月)回复于 2001-12-14 13:36:51 得分 0
我还写错了:
select distinct * into table2 from table1;
delete table1;
insert into table1 select * from table2;
drop table table2;
Top
4 楼panther_totem(青争岁月)回复于 2001-12-14 13:39:35 得分 10
强烈建议:用guasha(刮痧)的
select distinct * into #temp from table
delete table
insert into table select * from #temp
Top
5 楼LamLam(Steven)回复于 2001-12-14 13:46:12 得分 0
谢谢大家!! :)Top




