日期:2014-05-19  浏览次数:20505 次

请问一个选择的问题
select   1
union
select   2  
union
select   3
union
select   4  
union
select   5
......
union
select   9999


请问大家在不建立表的情况,怎么可以方便快捷的选择出我要的结果?

------解决方案--------------------
上面有些错误

select a+10*b+100*c+1000*d+1
from (
select 0 as a
union
select 1
union
select 2
union
select 3
union
select 4
union
select 5
union
select 6
union
select 7
union
select 8
union
select 9
) as a,(
select 0 as b
union
select 1
union
select 2
union
select 3
union
select 4
union
select 5
union
select 6
union
select 7
union
select 8
union
select 9
) as b,(
select 0 as c
union
select 1
union
select 2
union
select 3
union
select 4
union
select 5
union
select 6
union
select 7
union
select 8
union
select 9
) as c,(
select 0 as d
union
select 1
union
select 2
union
select 3
union
select 4
union
select 5
union
select 6
union
select 7
union
select 8
union
select 9
) as d
order by a+10*b+100*c+1000*d+1