select rowid ,a.* from cust1 a where a.rowid> (select min(b.rowid) from cust1 b where a.id=b.id )
delete from cust1 a where a.rowid> (select min(b.rowid) from cust1 b where a.id=b.id )
Oracle中删除表中相同记录的分析
分两种情况:
1,删除所有字段均相同的行:
create table tablexxx as (select * from tableyyy group by col1,col2,col3…)
drop table tableyyy
create table tableyyy as (select * from tablexxx)
drop table tablexxx
2,表中有id列,删除另一字段name取值相同的行:
delete b where id not in
(
select min(id) from B
group by name
)
delete from cust1 a where a.rowid> (select min(b.rowid) from cust1 b where a.id=b.id )
Oracle中删除表中相同记录的分析
分两种情况:
1,删除所有字段均相同的行:
create table tablexxx as (select * from tableyyy group by col1,col2,col3…)
drop table tableyyy
create table tableyyy as (select * from tablexxx)
drop table tablexxx
2,表中有id列,删除另一字段name取值相同的行:
delete b where id not in
(
select min(id) from B
group by name
)