create table 表1(编号 varchar(10),名称 nvarchar(10),规格 nvarchar(10))
insert 表1
select '01', N'铅笔', N'2B'
union all select '02', N'钢笔', N'圆质料12*6'
union all select '03', N'笔记本', N'A4版'
union all select '04', N'圆珠笔', N'蓝色'
create table 表2(序号 nvarchar(10), 注意内容 nvarchar(10))
insert 表2
select 'A', N'所有的文具用胶纸包装'
union all select 'B', N'不能压'
select ID_Num = IDENTITY(int, 1,1),编号,名称,规格 into #temp1 from 表1
select ID_Num = IDENTITY(int, 1,1),序号,注意内容 into #temp2 from 表2 group by 序号,注意内容 ---在这加一个group by 分组
select a.编号,a.名称,a.规格,b.序号,b.注意内容 from #temp1 a left join #temp2 b on a.ID_Num=b.ID_Num