例如
1
select a from table12
select b,c from table 2
======================
最终显示结果
a b c
2 3 4
2 3 4
2 3 4
thanks
1
select a from table12
select b,c from table 2
======================
最终显示结果
a b c
2 3 4
2 3 4
2 3 4
thanks
select a.a,b.b,b.c
from table 1 a,table2 b
select a.a,b.b,b.c
from table1 a,table2 b
如果有
select tb1.a,tb2.b,tb2.c from tb1 join tb2 on tb1.关联字段=tb2.关联字段
outer apply(select b,c from table2) n
a.a,b.b,b.c
from
(select id=row_number()over(order by getdate()),* from tb1)a,
(select id=row_number()over(order by getdate()),* from tb2)b
where
a.id=b.id
或者使用row_number,
或者使用下面的临时表
select *,identity(int,1,1) as id into #1 from tb1
select *,identity(int,1,1) as id into #2 from tb2
select a,b,c from #1 a,#2 b where a.id=b.id