首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

请教一个选择的有关问题

2012-01-30 
请问一个选择的问题select1unionselect2unionselect3unionselect4unionselect5......unionselect9999请问

请问一个选择的问题
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

热点排行