select * from table1 group by field1,field2,... having count(*)>1

解决方案 »

  1.   

    select * from tableA where exists(
    select 1 from (
    select col1,col2,...,coln from tableA group by col1,col2,...,coln having count(*)>1) tmp where tmp.col1=tableA.col1 and tmp.col2=tableA.col2 and ... and tmp.coln=tableA.coln)
      

  2.   

    select * from 表名 group by 全部列名 having count(*)>1
      

  3.   

    select *,count(*) from table_name where count(*)>1 group by field1,field2...
      

  4.   

    select * from 表名 group by 全部列名 having count(*)>1
      

  5.   

    select * from 表名 group by 全部列名 having sum(1)>1
      

  6.   

    select 全部列名 from 表名 group by 全部列名 having sum(1)>1
      

  7.   

    select 全部列名 from 表名 group by 全部列名 having sum(1)>1
      

  8.   

    select 全部列名 from 表名 group by 全部列名 having count(1)>1
      

  9.   

    查找某字段值重复记录
    select * from table1 a, table1 b
    where a.A<> b.A and a.C=b.C
    其中A为主键,C为要查找重复的字段例如下表:tablename
    P_code   C_code      nameselect * from tablename a tablename b
    where a.P_code<>b.P_code and a. C_code<>b.C_code and a.name=b.name