上图中是我split函数出来的表,我想把表并排合并成下面这种。我想最好不用到第三张表。如果必须用的话。请给出SQL语句。急等。谢谢了各位大神。
join on row_number=row_number.行不行(^^)
语法错误
@阿文sky: 用这个形式呀,这是伪代码好么
select 1 as a ,2 as b into #tmp1
insert #tmp1 values(2,4)
select 1 as c into #tmp2
insert #tmp2 values(2)
select * from #tmp1
select * from #tmp2
select t1.a,t1.b,t2.c from
(select *,ROW_NUMBER()over(order by a) id from #tmp1) t1
join (select *,ROW_NUMBER()over(order by c) id from #tmp2) t2 on t1.id=t2.id
@calvinK: 问题我自己已解决,感谢你的回答
把字段列先建出来,再复制数据不行么?