一列数据中有重复的值,一般都是2个重复,可能也有三个重复,其他的值都是唯一的。怎么只查处这些重复的数据是哪些。只要查重复的,不管几次。谢谢大家。

解决方案 »

  1.   

    select * from 表 group by ID having count(ID)>2
      

  2.   


    Select 重複的字段  from tb 
    group by 重複的字段  
    having count(1)>1
      

  3.   

    select id,count(*) from table group by id having count(id)>2 id 是会出现重复的字段
      

  4.   

    继续上面的问题啊。我已经查出来了,怎么删掉重复的数据啊,以上都是2条重复的数据,我要删除一条保留一条。侧视图 Side View 2
    侧影 Silhouette 2
    查尔斯顿 Charleston 2
    长时间曝光 Long Exposure 2
    长滩 Long Beach 2
    超声波 Ultrasound 2
    沉思 Meditating 2
    成年夫妇 Mature Couple 2
    成年人 Adult 2
    成年同性恋夫妇 Mature Couple 2
    成年子女 Adult Offspring 2
    抽象 Abstract 2
    抽象拼贴画 Collage 2
    触摸 Touching 2
    窗岩 Window Rock 2
      

  5.   


    Select distinct * into #tmp  from tb  ----把不重複的記錄插入到臨時表
    truncate table tb     ----清空原表insert into tb         ----從臨時表中再插入到原表中
    Select * from #tmpdrop table #tmp        ----刪除臨時表
      

  6.   

    select * from 表 group by ID having count(ID)>=2
      

  7.   

    貌似直接select * 不行。。select testid.address,testid.id from testid group by testid.id,testid.address having COUNT(id)>=2这个语句通过测试了 。你试试。