http://blog.csdn.net/ningoo/archive/2005/01/07/244503.aspx

解决方案 »

  1.   

    select identity(int,1,1) as ID ,a, b, c, d into #t from testdelete from #t where id not in(select min(id) from #t group by b,c)truncate table testinsert into test select a, b, c, d from #tdrop table #t
      

  2.   

    delete from table where b=c
      

  3.   

    delete from table where b=c
    up
      

  4.   

    alter table tt add id int identity(1,1)
    delete from tt where exists(select * from tt a where a.id>tt.id group by col1,col2 and tt.col1=a.col1 and tt.col2=a.col2)
    alter table tt drop column id
      

  5.   

    --参考--删除重复的记录 create table t1(id int identity(0,1),a varchar(10),b varchar(10))
    insert t1(a,b)
    select 'aa','bb'
    union all select 'a1','bgb'
    union all select 'aa','bb'
    union all select 'a2','bb'
    union all select 'aa3','beeb'
    union all select 'aa','bb'
    union all select 'a2','bb'delete t1 
    where id not in 
    (select min(id) as id from t1 group by a,b)select * from t1drop table t1/*
    id      a       b
    ------------------
    0 aa bb
    1 a1 bgb
    3 a2 bb
    4 aa3 beeb*/
      

  6.   

    group by a,b-----------------------------重复