欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

oracle 去重sql 博客分类: 数据库 oracle 

程序员文章站 2024-03-23 19:08:34
...
三种:

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);---分组去重
相关标签: oracle