Oracle积累

Oracle去除数据的常用方法

  1. dinstinct
  2. row_number()
    select *
      from (select t1.*,
                   row_number() over(partition by t1.col_2, t1.col_3 order by 1) rn
              from nayi224_180824 t1) t1
     where t1.rn = 1
    ;

 针对指定列,查出所有重复行

select *
  from (select t1.*,
               count(1) over(partition by t1.col_2, t1.col_3) rn
          from nayi224_180824 t1) t1
 where t1.rn > 1
;

上一篇:Oracle中wm_concat()函数的使用


下一篇:SQL开窗函数