select t.code, t.name, t.equalcode
from DW_2010_T_FMTERM t
where t.code>=1 and t.code<=12 and equalcode is null
order by t.code语句如上,如果运行的部分不加order by,那么结果为 1,2,3,4,5,6,7,8,9,10,11,12如果加上order by code,反而成了。。1,10,11,12,,2,3,4,5,6,7,8,9这是为什么呢?
from DW_2010_T_FMTERM t
where t.code>=1 and t.code<=12 and equalcode is null
order by t.code语句如上,如果运行的部分不加order by,那么结果为 1,2,3,4,5,6,7,8,9,10,11,12如果加上order by code,反而成了。。1,10,11,12,,2,3,4,5,6,7,8,9这是为什么呢?
select t.code, t.name, t.equalcode
from DW_2010_T_FMTERM t
where t.code>=1 and t.code<=12 and equalcode is null
order by to_number(t.code)
order by to_number(t.code)
结果当然就是:
1,2,3,4,5,6,7,8,9,10,11,12
order by to_number(t.code)