select distinct * into #a from a--将不重复的记录存到暂存的表格中
insert into a
  select * from #a

解决方案 »

  1.   

    写掉了:
    select distinct * into #a from a--将不重复的记录存到暂存的表格中
    truncate table a
    insert into a
      select * from #a
    drop table #t
      

  2.   

    select distinct * into #a 
    from a group by 性命,出生年月,年龄
    having count(*)>1delete a from a a,#a b where a.性命=b.性命 and a.出生年月=b.出生年月
    and a.年龄=b.年龄insert into a(性命,出生年月,年龄)select 性命,出生年月,年龄 from #a
      

  3.   

    问:
    我编写了下面的语句老是不对,请高手给指点。select distinct * into a from  A--将不重复的记录存到暂存的表格中
    select * fron a答:sql server默认是不区分大小写的,所以你的a和A指的是同一张表所以出错
      

  4.   

    select * fron a
    也写错了,是
    select * from a
      

  5.   

    谢谢大家的出谋划策我刚才在等待的过程中自己作出来了就是
    select distinct * into a  from A
    delete from A
    insert A
    select * from a
    这样也可以达到这个效果但是我向咨询一下,这个编程是不是有漏洞,或者不足的地方请专家给点评一下。
      

  6.   

    select distinct * into a  from A
    delete from A
    insert A
    select * from a这样比较麻烦,但是比较合符大多数人的思想.
    直接用delet from a where a.姓名 in (select* from a group by 性命,出生年月,年龄
    having count(*)>1)
      

  7.   

    临时表在ASP语句中好像用不起啊
      

  8.   

    select distinct * into #a  from table
    delete from table
    insert table select * from #a
      

  9.   

    delete 
    select *
    from  Table
    group by 号码
    Having Count(*)>1