SQLSERVER 将两个表的字段并列起来
如何将两个表的字段并列起来?请看以下列子
A表:
col1
1
2
3
B表:
col2
A
B
C
结果:
col1 col2
1 A
2 B
3 C
实现代码:
select T1.col1,T2.col2 from ( select col1,row_number() over(order by col1) as row_num from tb1 )T1, ( select col2,row_number() over(order by col2) as row_num from tb1 )T2 where T1.row_num = T2.row_num