select identity(int,1,1) as id,* into #t from ttdelete from tt where exists(select * from tt a where a.id>tt.id and a.a=tt.a and a.b=tt.b)--ordelete from tt where exists(select * from tt a where a.id<tt.id and a.a=tt.a and a.b=tt.b)

解决方案 »

  1.   

    delete from tt where exixts
    (select a,b,min(c)as c from tt group by a,b having count(1)>1)
      

  2.   

    我想用
    1  select * into ytt from tt  用distinct(a,b), 然后
    2   drop tt ,然后在
    3   select * into tt from ytt  应该怎么写那?
      

  3.   

    就是如何用distinct()筛选出重复的记录不好办
      

  4.   

    select distinct * into tab from tb
    delete from tb
    insert into tb select * from tab
    drop table tab