ITeye博客

oracle 去重sql

qnzhl · 2015-04-12 10:20 · 数据库 · 数据库 · Oracle · Markdown

三种:

1.delete from table1 a where rowid not in( select max(rowid) from table1 b group by (去重字段));

2.delete from table1 a where rowid !=( select max(rowid) from table b where a.name=b.name and b.sex=a.sex );

3.insert into tem_tab select distinct mobile from old_tab; drop table old_tab; rename tem_tab to old_tab;

4.delete from table1 where rowid in( select rowid from ( select rowid,deptno,name,age, row_number() over(partition by deptno order by age desc) rn from emp_zh)where rn>1);---分组去重

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。