select * from 
(select id ,  customer ,phone from a
union all
select id ,  customer ,phone from b) as w into c

解决方案 »

  1.   

    不好意思写错了应该
    select * into c from 
    (select id ,  customer ,phone from a
    union all
    select id ,  customer ,phone from b) as w
      

  2.   

    union all遇到相同的纪录全部保留,如果重复的保留一条,用union
    如果c不存在:
    select d.* into c from 
    (select id ,  customer ,phone from a
    union 
    select id ,  customer ,phone from b) as d已经存在,插入
    insert into c 
    select d.* from  
    (select id ,  customer ,phone from a
    union 
    select id ,  customer ,phone from b) as d
      

  3.   

    C表不存时:select * into C
    from
         (
           select id,customer,phone from a
           union all
           select id,customer,phone from b
         )tC表存在时:
    insert C
    select * 
    from
         (
           select id,customer,phone from a
           union all
           select id,customer,phone from b
         )t
      

  4.   

    drop table c
    select * into c from 
    (select id ,  customer ,phone from a)
    union all
    (select id ,  customer ,phone from b)
      

  5.   

    insert C
    select id,customer,phone from 表1
    union all
    select id,customer,phone from 表2
    union all
    select id,customer,phone from 表3
    union all
    .............
      

  6.   

    再多的表也是类似的,反正就是union 或者union all