sqlserver outer join

create table #BOM1
(
ID int not null primary key,
PARENT VARCHAR(10),
TYPE1 VARCHAR(10),
)


insert into #BOM1
values
(1,'FG1','FG'),
(2,'FG2','FG'),
(3,'FG1','FG'),
(4,'FG1','FG'),

create table #BOM2
(
ID int not null primary key,
SON VARCHAR(10),
TYPE2 VARCHAR(10),
QTY INT
)

insert into #BOM2
values
(4,'RAW2','P',5),
(5,'RAW3','P',6),
(6,'RAW3','P',2),
(7,'RAW4','P',3)

select * from #BOM1 as a full outer join #BOM2 as b on a.ID=b.ID

原文地址:https://www.cnblogs.com/pythonClub/p/14971554.html