`
qnzhl
  • 浏览: 28898 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

oracle 去重sql

阅读更多
三种:

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);---分组去重
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics