日期:2014-05-17 浏览次数:20464 次
select * from a
union all
select * from b
if object_id('A') IS NOT NULL
DROP TABLE A
go
create table A
(
id int,
Code varchar(10)
)
go
if object_id('B') IS NOT NULL
DROP TABLE B
go
create table B
(
id int,
Code varchar(10)
)
go
insert into a
select 1,'A001' UNION ALL
select 2,'A002' UNION ALL
select 3,'A003'
GO
INSERT INTO B
select 1,'B001' UNION ALL
select 2,'B002' UNION ALL
select 3,'B003'
GO
--select * from a
--union all
--select * from b
insert into B
select A.* FROM A,B WHERE A.ID = B.ID
GO
select * from B