select distinct * into 新表名 from tablename
drop table tablename
将新表名改成tablename

解决方案 »

  1.   

    select identity(int,1,1) id,* into #t from aa
    delete #t where id>(select id from #t b where #t.xh=b.xh)
    delete aa
    insert aa select ... from #t
      

  2.   

    可以使用临时表,select distinct * into #newtable from oldtable 
                       delete from oldtable
                   insert into oldtable (字段名)select * from #newtable
                     drop table #newtable
      

  3.   

    select identity(int,1,1) id,* into #t from aa
    delete #t where id>(select min(id) as id from #t b where #t.xh=b.xh)
    delete aa
    insert aa select ... from #t
      

  4.   

    select id=identity(int,1,1) ,* into #t from tabledelete  from #t where id not in
    select id=min(id) from #t a inner join #t b on a.xh=b.xh group by xhinsert into aa select 列名  from #t
      

  5.   

    TO lxd99423(苹果) 
    记录里没有id这个字段,怎么办??/