sys_connect_by_path连接的字符串顺序反了?
select ltrim(max(sys_connect_by_path(name,'-')),'-') from dbtree start with dbtree.id=36 connect by prior dbtree.p_id=dbtree.id
如上sql,出来的结果是:
综合,文书类我要的结果是:
文书类,综合------解决方案--------------------connect by prior dbtree.p_id=dbtree.id
是这个反了,
应该是
connect by prior dbtree.id=dbtree.p_id
------解决方案--------------------connect by prior dbtree.p_id=dbtree.id
是这个反了,
应该是
connect by prior dbtree.id=dbtree.p_id
------解决方案--------------------楼上2位正解 把 prior 拿到 = 号后面
------解决方案--------------------父子关系调换一下
------解决方案--------------------connect by prior 后面的前后关系调换一下~~