ORACLE 樹形查詢 樹查詢,oracle樹形查詢

來源:互聯網
上載者:User

ORACLE 樹形查詢 樹查詢,oracle樹形查詢

前台樹結構根據個人的許可權登入變化 所有我查詢要根據 樹的ID 查詢下面所有的子節點 以及本節點的資訊

 select * from table start with id = #{id} connect by prior id = pid

這裡的id就是 父節點的ID 



oracle查詢樹形顯示問題

通過start with connect by可以查詢樹結構
select * from users start with parentid = 0 connect by prior id = parentid
 
oracle樹狀查詢

select * from emp start with empno='xxx' -- 從員工號=xxx開始 connect by prior managerid = empid -- 上一行的經理=本行的員工id
 

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.