如何检测表中某个字段重复的数据?

解决方案 »

  1.   

    ---?
    select 某个字段,cnt=count(某个字段)
    from 表
    group by 某个字段
    having count(某个字段)>1
      

  2.   

    select 某个字段 from 表 group by 某个字段 having(count(1))>1
      

  3.   

    select 字段 from [Table] group by 字段 having(count(1)>1)
      

  4.   

    select * from tablename where column in(select culumn from tablename group by column having count(*)>1)
      

  5.   


    --显示重复次数
    select count(*) as 重复次数,检验字段 from table1 group by 检验字段--筛选不重复:
    select distinct * from table1
      

  6.   

    select 字段 from [Table] group by 字段 having count(*)>1
      

  7.   

    除了:select 字段 from [Table] group by 字段 having count(*)>1
    这种形式有无其它方法呢?
      

  8.   

    select * from table a where not exists (select 1 from table where name=a.name and a.id>b.id )
      

  9.   

    select * from [Table] a where (select count(1) from [Table] where 字段=a.字段)>1