日期:2014-05-17 浏览次数:20555 次
with a(a,b)as(
select 15.000,1 union all
select 4.000, 1 union all
select 1.762,-1 union all
select 7.000, 1 union all
select 2.207,-1 union all
select 1.644,-1)
, tc as(
select number=ROW_NUMBER()over(order by getdate()),* from a
)
select c,d from (
select number,a c,null d from tc where b=1
union all
select number,null,a from tc where b=-1)a
order by number
select
case when b=1 then a else null end c,
case when b=-1 then a else null end d
from table1