select rank() over(order by t.treecode) rowno ,decode (rank() over(order by t.treecode) rowno, 1,'一', 2,'二', 3,'三', 4,'四', 5,'五', 6,'六', 7,'七', 8,'八', '九') as asdf , t.code , t.name as name1 from ip_ct_goodJob_assessType t order by t.treecode
我不用decode判断输出数字 用哪个分析函数就没错。。怎么我放到decode判断函数里 在用个分析函数他就会给我报
select rank() over(order by t.treecode) rowno
,decode (rank() over(order by t.treecode),--去掉里面的rowno
1,'一',
2,'二',
3,'三',
4,'四',
5,'五',
6,'六',
7,'七',
8,'八',
'九') as asdf
, t.code
, t.name as name1
from ip_ct_goodJob_assessType t order by t.treecode
select rank() over(order by t.treecode) rowno
,decode (rank() over(order by t.treecode),
1,'一',
2,'二',
3,'三',
4,'四',
5,'五',
6,'六',
7,'七',
8,'八',
'九') as asdf
, t.code
, t.name as name1 ,rownum rn
from ip_ct_goodJob_assessType t order by t.treecode
rownum是显示行序列号,sql中通过rank是算出根据treecode求排名。
就算你把rowno 哪里写错rownum 也是不对的,这里是为列加别名的意思。