select a.* from 表 a where (select count(*) from 表 where 字段=a.字段)>1

解决方案 »

  1.   

    -try
    select 字段 from 表 
    group 字段
    having count(*)>1
      

  2.   

    create  table t(id int,name varchar(10))insert into t
    select 1,'a' union all
    select 2,'b' union all
    select 3,'c' union all
    select 4,'a' union all
    select 5,'b'select * from t where name in(
    select name from t group by name having count(name)>=2)
    結果:
    id          name       
    ----------- ---------- 
    1           a
    2           b
    4           a
    5           b