delete t
from 表 t
where exists(select 1 
                from 表 
                   where word=t.word 
                          and pinying=t.pinying 
                          and bihua=t.bihua 
                          and id<t.id)

解决方案 »

  1.   

    id(整型,其值自动加1),word(字),pinying(字的拼音),bihua(字的笔画)delete t where convert(varchar(20),id)+word+pinyin+bihua not in(select convert(varchar(20),min(id))+word+pinyin+bihua from t group by word,pinyin,bihua)
      

  2.   

    1.方法一
    可以不用语句
    假设原来的表为TableA,customer重复则为重复,需要保留一笔即可
    建立一张具有和TableA相同结构的临时表myTableA,单击鼠标右键,选择所有任务,选择管理索引,选择新建,起个索引名字,列就是customer,建立一个索引,勾选上唯一(unique),勾选上忽略重复的值,其他不要选择!然后把资料insert into到临时表,
    此时SQL Server会返回如下提示:
      服务器: 消息 3604,级别 16,状态 1,行 1
      已忽略重复的键。
      它表明在产品信息临时表myTableA中不会有重复的行出现。然后将原表TableA清空,并将临时表myTableA中数据导入,最后删除临时表myTableA。
    这样就完成了对表中重复记录的删除。该方法的执行速度都是相当快的,而且因为几乎不用写语句,所以它也是很安全的。不过要依靠你的customer,万一你操作不当,没有关系,不要那么急着删除原来的表,这样不会出什么异常,错删除纪录!2.如果你是认为要customer PhoneNo2个子段相同才认为是重复,那么你就是组合字段为主键,方法也是如上3.如果非要用语句,就用 vivianfdlpw() 的,因为你要key 值,如果没有就自己造一个,用identity(data_type,seed,increment),select到一个临时表,然后删除重复的,然后删除原表所有,然后插入即可
      

  3.   


    delete b from [table] b where exists(select 1 from [table] a where a.word =b.word
    and a.pinyin=b.pinyin and a.bihua=b.bihua and a.id < b.id)
      

  4.   

    delete t from 表 t
    where exists(select 1 from 表 where word=t.word 
                              and pinying=t.pinying 
                              and bihua=t.bihua 
                              and id<t.id)
    vivianfdlp的办法就可以,所以重复一下
      

  5.   

    vivianfdlp的办法是不是只能删除一个指定的重复记录?
    如果要删除表A中的所有的重复记录,语句该怎么写?