select distinct * into #temp from table 
delete from table
insert into table select * from #temp
drop table #temp

解决方案 »

  1.   

    其中,distinct把重复记录全部压缩为一条记录!
      

  2.   

    alert table [表名] add id int identity(1,1)delete from 表名 where id not in (select min(id) as id from 表名 group by 列名)alert table [表名] drop column id
      

  3.   

    Monkey兄,这样好像也不能删除重复的数据,都要留一条,不知这样如何:alert table [表名] add id int identity(1,1)select count(id) as num,列名 into #temp from 表名 group by 列名
    delete from table where 列名 in(select 列名 from #temp where num>1)
    drop table #tempalert table [表名] drop column id
      

  4.   

    可以呀
    GROUP BY 选择重复列 不能包括ID
      

  5.   

    monkey哥,我试了你写的代码,报错说列名id无效,是什么意思?