select 字段1,字段2,字段3 from tablename group by 字段1,字段2,字段3 having count(*)>1

解决方案 »

  1.   

    方法1:
    SQL> Select * FROM table_name A WHERE ROWID > (
         SELECT min(rowid) FROM table_name B
         WHERE A.key_values = B.key_values);方法2:
       SQL> select * from table_name t1
            where  exists (select 'x' from table_name t2
                            where t2.key_value1 = t1.key_value1
                            and t2.key_value2 = t1.key_value2
                             and t2.rowid      > t1.rowid);
      

  2.   

    如何删除没有主键的表中的重复记录? 
    http://www.oracle.com.cn/cgi-bin/topic_show.cgi?id=4983&h=1&bpg=1&age=0 
    http://www.oracle.com.cn/cgi-bin/topic_show.cgi?id=4873&h=1#16842 
    http://www.oracle.com.cn/cgi-bin/topic_show.cgi?id=4394&h=1#14785