▲使用伪列去掉同一个表中的重复数据
delete tb_temp a
where a.rowid<>(select max(rowid) from tb_temp b
where a.phone_no=b.phone_no);
delete tb_temp a
where a.rowid<>(select max(rowid) from tb_temp b
where a.phone_no=b.phone_no);
----- -----
1 Zhang
2 Wang
3 Li
2 Wang
1 ZhangSQL>
SQL> delete tb_temp A
2 where A.rowid<>(select max(rowid) from tb_temp B
3 where A.a=B.a and A.b=B.b);2 行 已删除SQL> select * from tb_temp;A B
----- -----
3 Li
2 Wang
1 Zhang
select * into #tmpp from youtable
insert into youtable select top 1 * from #tmpp
drop table #tmpp
select * into #tmpp from youtable where id=8888
delete youtable where id=8888
insert into youtable select top 1 * from #tmpp
drop table #tmpp
as
select distinct(a.*) from tableA a 然后drop以前那个表
最后rename tableA_bak to tableA最好在不用这张表的时候。