麻烦问一下
在oracle里面 我写了一个排序
在表里面 有些值是空的
比如 ‘10’,‘2’,‘1’,‘ ’
但是不管是升序还是降序
空的这个始终是排在第一位
‘ ’
‘10’
‘2’
‘1’麻烦问一下 这个怎么解决
我想把null的这个降序排列的时候放在最后
‘10’
‘2’
‘1’
' '
在oracle里面 我写了一个排序
在表里面 有些值是空的
比如 ‘10’,‘2’,‘1’,‘ ’
但是不管是升序还是降序
空的这个始终是排在第一位
‘ ’
‘10’
‘2’
‘1’麻烦问一下 这个怎么解决
我想把null的这个降序排列的时候放在最后
‘10’
‘2’
‘1’
' '
drop table test;
create table test (col1 number);
insert into test values (1);
insert into test values (10);
insert into test values (null);
insert into test values (2);
commit;
select * from test;
COL1
----------
1
10
2
{null}select * from test order by col1 desc nulls first;
COL1
----------
{null}
10
2
1
select * from test order by col1 desc nulls last;
COL1
----------
10
2
1
{null}
to_number(decode(columnname,'',0,columnname))