表A
列1 列2 列3
a1 b1 c1
a2 b2 c2
表B
列1 列2 列3
d1 e1 f1
d2 e2 f2
A,B表无任何关系,如何用select实现以下结果
列1 列2 列3 列4 列5 列6
a1 b1 c1 d1 e1 f1
a2 b2 c2 d2 e2 f2也就是表A和表B连接起来,1条A的记录连接1条B的记录就行,无视顺序
列1 列2 列3
a1 b1 c1
a2 b2 c2
表B
列1 列2 列3
d1 e1 f1
d2 e2 f2
A,B表无任何关系,如何用select实现以下结果
列1 列2 列3 列4 列5 列6
a1 b1 c1 d1 e1 f1
a2 b2 c2 d2 e2 f2也就是表A和表B连接起来,1条A的记录连接1条B的记录就行,无视顺序
with cte as
(
select rn = row_number() over (order by getdate()),*
from a
),cta as
(
select rn = row_number() over (order by getdate()),*
from b
)select *
from cte left join cta on cte.rn = cta.rn
with cte as
(
select rn = row_number() over (order by getdate()),*
from a
),cta as
(
select rn = row_number() over (order by getdate()),*
from b
)select *
from cte inner join cta on cte.rn = cta.rn
(select row_number() over(order by 列1) as no,* from tb1) a
left join
(select row_number() over(order by 列1) as no,* from tb2)b
on a.no=b.no
-- 在这里面自选 自助餐