删除表中重复的数据(本表没有主键,不同行间所有数据相同才算重复)sql语句怎么写?知道怎么查询 可是怎么删除亚

解决方案 »

  1.   

    1:
    select distinct * into #t from t 
    2:
    delete t
    3:
    insert into t
    select * from #t
      

  2.   

    先查询出不重复的结果放到临时表,
    truncate table 原表
    临时表倒到原表中
      

  3.   

    declare @a table( fd Nvarchar(23),ff int)
    insert @a select 'fda' ,1
    insert @a select 'fda',1
    insert @a select 'f',3delete from @a where checksum(*) in(select checksum(*) from @a group by fd,ff having count(1)>1)
    select * from @a
      

  4.   

    delete t a
    where exists(select 1 from t where a.字段1=字段1.... )
      

  5.   

    还是"fa_ge(鶴嘯九天) "的第一种方法 简单方便select distinct * into #t from t delete tinsert into t select * from #t
      

  6.   

    回楼上的
    delete t
    没有
    truncate table T
    的效率高