日期:2014-05-18 浏览次数:20468 次
select A1,B1 from tbname union all select A2,B2 from tbname
------解决方案--------------------
--Code
select row_number() over(order by A1) as id,t.* from
(
select A1,B1 from @T
union all
select A2,B2 from @T
) t
--Drop
--Result
/*
id A1 B1
-------------------- ---- ----
1 a1 b1
2 a10 b10
3 a2 b2
4 a20 b20
*/