select * from table1 where id in (select id from table1 group by id having count(*) > 1)

解决方案 »

  1.   

    select 字段名 from t group by 字段名 having count(1)>1
      

  2.   


    select * from table1 a where id in (select id from table1 id=a.id and other<>a.other)楼主的意思是要所有重复得记录吧,上面的other为你的一个并不重复的其他字段
      

  3.   

    select * from 表 a join 
    (select 某个重复字段,count(某个重复字段) as idd from 表
                     group by 某个重复字段 having count(某个重复字段)>1
    ) b
    on a.某个重复字段=b.某个重复字段
      

  4.   

    或者
    select * from 表 a
     where exists (select 1 from 表 where 某个重复字段=a.某个重复字段
                         group by 某个重复字段 having count(某个重复字段)>1)
      

  5.   

    select * 
    from T a
    where (select count(*) from T where 某个重复字段 = a.某个重复字段) > 1
      

  6.   

    谢谢各位,已经搞定了,用的是exist