delete from tbname where rowid not in( select max(rowid) from tbname group by a,b);
delete from tab A where rowid>(select min(rowid) from tab B where A.a=B.a and A.b=B.b)
delete from ABC a where a.rowid!=(select max(rowid) from ABC b where a.a=b.a and a.b=b.b and a.c=b.c) 和 delete from tbname where rowid not in( select max(rowid) from tbname group by a,b) 任何一种方法都可以实现,两种方法没有什么本质的区别
select distinct * into #t from ABC delete from ABC insert into ABC select * from #t drop table #t
楼上的兄弟,oracle不支持这样的语法创建表吧
delete from ABC a where a.rowid not in(select max(rowid) from ABC b where a.a=b.a and a.b=b.b and a.c=b.c)
select max(rowid) from tbname group by a,b);
where rowid>(select min(rowid) from tab B where A.a=B.a and A.b=B.b)
和
delete from tbname where rowid not in(
select max(rowid) from tbname group by a,b)
任何一种方法都可以实现,两种方法没有什么本质的区别
delete from ABC
insert into ABC
select * from #t
drop table #t