数据字段id  name
1    a    
2    a
3    b
4    c
5    c
6    d我想把表里的 name 重复的项查出来 怎么写啊??

解决方案 »

  1.   

    select * from t 
    where name 
          in (select name 
              from t 
              group by name 
              having count(name)>=2 )
      

  2.   

    create table test( cid int,seqid varchar2(100) );
    /
    insert into test 
    select 1,'a' from dual union all
    select 2,'a' from dual union all
    select 3,'b' from dual union all
    select 4,'c' from dual union all
    select 5,'c' from dual union all
    select 6,'d' from dual;
    --执行查询
    select * from test where seqid in
    (select seqid from test group by seqid having count(*)>1)
    --执行结果
    1 a
    2 a
    4 c
    5 c
      

  3.   

    select a.* from t a ,t b where a.id<>b.id and a.name=b.name(要求ID是唯一的)或用以下的方法select name,count(*) from t
    group by name 
    having count(*) >1
      

  4.   

    select ename from emp
    group by ename
    having count(ename)>1
      

  5.   

    to :  wwwzjb(zjb)
    select a.* from t a ,t b where a.id<>b.id and a.name=b.name(要求ID是唯一的)
    这个方法不对