oracle两条重复数据怎么删除
发布网友
发布时间:2022-04-26 20:50
我来回答
共1个回答
热心网友
时间:2022-04-08 07:43
.不含大字段(clob等)的表格:
1
2
3
4
5
6
7
8
9
--例子表格:create
table
test(a
number,b
number);
--方法一:通过group
by
+
rowid,效率低
delete
from
test
t
where
t.rowid
not
in
(select
min(rowid)
from
test
group
by
a,
b);
--方法二:通过
create
+
rename
+
distinct
,效率高
create
table
test_tmp
as
select
distinct
*
from
test
t;
drop
table
test;
alter
table
test_tmp
rename
to
test;