表
create table AA_TEST
(
aaaa NVARCHAR2(20),
bbbb NUMBER,
cccc NVARCHAR2(20)
)
删除分两步:先保存满足要求的
delete from aa_test t where (t.aaaa,t.bbbb) not in (
select t1.aaaa,max(t1.bbbb) from aa_test t1 group by t1.aaaa
);
第二步再在第一步基础上删去重复记录
delete from aa_test t where rowid not in(
select min(rowid) from aa_test t1 where t.aaaa = t1.aaaa and t.bbbb = t1.bbbb
);
时间: 2024-10-10 03:38:19