Oracle去除表重复数据

--1,删除前先查询核实

select b.idcard,b.name,count(b.idcard) num from table1 b group by b.idcard,b.name having count(b.idcard)>1

--1,删除前先查询核实数据量
select count(1) number from table1

--2,删除前请先备份所有数据,避免数据损失。
create table table1备份 as
select * form table1

--3,删除
delete  table1 tt where rowid in

--select * from table1 tt where exists

(select max(rowid) from table1 b group by b.idcard,b.name having count(b.idcard)>1)


--4,在核查数据是否已经处理完毕,操做第一步,第二步核实。

--5,若是有问题请经过第三步的备份表核实数据。
相关文章
相关标签/搜索