oracle去重:综合了别人的记录,大致有以下两种看起来顺眼。
1.delete from t
where rowid not in (select min(rowid) from t group by 去重字段);
举个栗子:
--去重
delete from PTW_I_METHOD_DEFINE_TEMP
where id not in (select min(id) from PTW_I_METHOD_DEFINE_TEMP group by no);
2.(注意:distinct是记录完全一致的重复。而上面是以某一列的值是否重复来决定)
insert into 临时表 select distinct mobile from 原表;
drop table 原表;
rename 临时表名 to 原表名;
来源: <http://blog.163.com/k_doll/blog/static/7845013020091361626770/>