不好意思写错了应该 select * into c from (select id , customer ,phone from a union all select id , customer ,phone from b) as w
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
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
drop table c select * into c from (select id , customer ,phone from a) union all (select id , customer ,phone from b)
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 .............
select * into c from
(select id , customer ,phone from a
union all
select id , customer ,phone from b) as w
如果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
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
select * into c from
(select id , customer ,phone from a)
union all
(select id , customer ,phone from b)
select id,customer,phone from 表1
union all
select id,customer,phone from 表2
union all
select id,customer,phone from 表3
union all
.............