表1中有个字段 M ,怎样把重复的记录删除啊!

解决方案 »

  1.   

    --假设有唯一字段IDdelete 表名
    where id not in (select min(id) from 表名 group by M)
      

  2.   

    如果只有一个字段:select distinct * into #temp from 表truncate table 表insert into 表 select * from #tempdrop table #temp
      

  3.   

    同意楼上的看法!
    如果不只一个字段!delete a from table a where exists(select 1 from table1 b a.m=b.m and a.id>b.id)