select distinct 字段名 into #a from tablename
delete from tablename
select * into tbalename from #a
drop table #a
go

解决方案 »

  1.   

    先建一个视图
    select count(*) from yourtable group by ID
    找出有两条以上记录的数据
    再有条件删除
      

  2.   

    select distinct * into #temp from 表
    truncate table 表
    insert 表 select * from #temp
    drop table #temp
      

  3.   

    或:删除重复的,只留一条:alter table 表 add  newfield int identity(1,1)delete 表
    where newfield not in(
     select min(newfield) from 表 group by 除newfield外的所有字段
                         )alter table 表 drop column newfield
      

  4.   

    select distinct 字段名 into 临时表 from tablenamedelete from tablenameselect * from 临时表 into tbalename from 临时表drop table 临时表