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,若是有問題請經過第三步的備份表覈實數據。
相關文章
相關標籤/搜索