如何过滤掉重复行,各个字段的内容完全重复。

解决方案 »

  1.   

    可考虑用分析函数row_number() over()
      

  2.   

    各个字段都重复用distinct关键字不行?
    楼上说的row_number() over()不知道该怎么用.
      

  3.   

    恩。LS对的。
    我错看成是LZ是想找出重复的行了。
      

  4.   

    --如:table_test(t_id,t_name);delete from table_test 
        where t_id not in (select max(t_id) 
                                  from table_test
                           group by t_name);
      

  5.   

    select distinct * from tablename
      

  6.   

    先帮你找出来吧
    select item_code from table having count(item_code)>1;
    这是找出item_code重复的,至于怎么过滤掉办法很多。
      

  7.   

    --如:table_test(t_id,t_name);-- 根据数据库本身的标示
    select * from 
    (select rowid rw ,row_number() over(partition by t_id) rn,t_id,t_name from table_test )
    where rn=1
    当然如果要 delete多余的行就很简单了 
    delete table_test
    where rowid not in (select rw from 
    (select rowid rw ,row_number() over(partition by t_id) rn,t_id,t_name from table_test )
    where rn=1
    )