用oracle 函数 拼全名

来源:互联网 发布:淘宝联盟提现手续费30 编辑:程序博客网 时间:2024/04/30 01:13

 select max(sys_connect_by_path(c.channel_name,'/')) //取最长的一条
from sinocms_channel c
start with c.id='1000010141'
connect by prior parent_id=id ;

结果:/添加栏目命喝彩/IT信息期刊/内容发布系统(倒的 ,从子到父)
(对应的id    1000010141/1000010106/0)

//
select max(sys_connect_by_path(c.channel_name,'/'))
from sinocms_channel c
where id='1000010141'
start with c.id='0'
connect by parent_id= prior  id ;
结果:/内容发布系统/IT信息期刊/添加栏目命喝彩(正的,从父到子)
(对应的id   0/1000010106/1000010141)

 

区别:prior 放的位置,决定拼得串的顺序

原创粉丝点击