表中有3个字段,分别为:   id    pwd    home比如:
id    pwd   home
111   222   333
111   222   333
111   222   333这样的数据就是重复的求一个语句,把这样的数据留一个, 剩下的全删

解决方案 »

  1.   

    参考http://bbs.csdn.net/topics/240034273
      

  2.   


    with tb(a,id,pwd,home) as
    (
    select row_number() over(partition by id,pwd,home order by id)a,* from 表名
    )
    delete tb where a>2
      

  3.   

    单纯从数据来说:直接select distinct * from 表 不就可以咯?
      

  4.   

    然后把这些数据先存到一个临时表,然后turncate源表,再把数据插回去。方法有多种,
      

  5.   

    1 :首先查找出重复的数据并且过滤掉 ,然后复制到一张临时表里面
    select * into temp from (select distinct* from tab) as a
    2:删除之前的原始表 
    drop table tab
    3:把临时表里面的数据再复制到原始表里(注:这里的原始表意义上是和之前的那个表的表名一样)
    select * into tab from temp
      

  6.   

    select * into temp from (select distinct* from tab) as a
    最后面那个a 是干啥的啊
      

  7.   

    步骤1:select distinct * into #t from tb
    步骤2:truncate table tb
    步骤3:insert into tb select * from #t
    步骤4:drop table #t
      

  8.   


    select * into #a from txtinsert into txt
    select distinct id,pdw,home from #adrop table #a
      

  9.   

    (a,id,pwd,home)
    这里的a是干嘛的啊