select 身份证号 from tablename group by 身份证号 having count(身份证号)>=3

解决方案 »

  1.   

    tb_cust   cust_name   cust_sex  cust_reg_nbrselect * from tb_cust where cust_reg_nbr in 
    (select cust_reg_nbr from tb_cust group by cust_reg_nbr having count(*)>=3)
    如果表很大,要有索引,否则很慢
      

  2.   

    if exists(select * from sysObjects where id=object_id(N'tp'))
      drop table tp
    create table tp(姓名 varchar(10),性别 char(2),身份证号 varchar(18)
    )
    insert into  tp
    select            'a','m','123'
    union all select  'b','m','123'
    union all select  'a','f','123'
    union all select  'a','m','113'
    union all select  'a','m','133'
    select * from tp where 身份证号 in(select 身份证号 from tp
                                      group by 身份证号
                                      having count(身份证号)>=3)
      

  3.   

    select 姓名,性别,身份证号 from 表 group by 身份证号 having count(身份证号)>3
      

  4.   

    to:chiwei(水手) 
       你测试过你的SQL语句了吗?
       要负责的哦~~~~~~~~~~~~~ 嘿嘿 !
      

  5.   

    select max(姓名),max(性别),身份证号 from tablename 
    where 身份证号='2354672784513'
    group by 身份证号
    having count(*) >3
      

  6.   

    select * from tp a where exists  (select * from tp where a.身份证号 = tp.身份证号  having count(*) > 3)