这样查询就不会出现重复记录了。
select * from a 
union select * from b
union select * from c 再者,你是删除联合表中的重复记录,可是你要删除哪个表中的记录呢。
还有就是你的单个表中有重复记录吗?

解决方案 »

  1.   

    select distinct * from a 
    union select  distinct  * from b
    union select  distinct * from c
      

  2.   

    不管哪一个表中的,
    有可能A表和B表中的某一条记录相同
    或者
    A表自身的二条记录重复
    或者
    A表和C表中的某一条记录相同
    就必须删除不管中哪个表中的一条
      

  3.   

    select 
        identity(int,1,1) as row,d.*
    into #t
    from 
        (select * from a union all select * from b union all select * from c) d
    select d.* from #t d where not exists(select 1 from #t where idcard=a.idcard and row<a.row)
      

  4.   

    select 
        identity(int,1,1) as row,d.*
    into #t
    from 
        (select * from a union all select * from b union all select * from c) d
    select d.* from #t d where not exists(select 1 from #t where idcard=d.idcard and row<d.row)
      

  5.   

    谢谢libin_ftsafe(子陌红尘) ,操作你以上的查询,提示---------
    数据库中已存在名为 '#t' 的对象。
      

  6.   

    delete a where idcard in (select distinct idcard from b union selet distinct idcard from c)
    delete b where idcard in (select distinct idcard from a union selet distinct idcard from c)
    delete c where idcard in (select distinct idcard from a union selet distinct idcard from b)
    不知道是不是你想要的