oracle樹形查詢
create table test
(ID NUMBER(18) not null,
name vaechar2(50),
parent_id NUMBER(18)
);
--查詢當前節點下的所有子節點
select * from test t start with t.id='當前節點ID' connect by prior t.id=t.parent_id;
--查詢當前節點的父節點或者父節點以上的節點
select * from test t start with t.id='當前節點ID' connect by t.id= prior t.parent_id;
(ID NUMBER(18) not null,
name vaechar2(50),
parent_id NUMBER(18)
);
--查詢當前節點下的所有子節點
select * from test t start with t.id='當前節點ID' connect by prior t.id=t.parent_id;
--查詢當前節點的父節點或者父節點以上的節點
select * from test t start with t.id='當前節點ID' connect by t.id= prior t.parent_id;
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章
Postman 拷貝 curl 不識別 --data-raw
亮sir
2024-06-06 14:26:55
985 碩士程序員,空窗 4 個月沒有 Offer!
Java技術棧
2024-06-06 14:24:35
(數據科學學習手札161)高性能數據分析利器DuckDB在Python中的使用
費弗裏
2024-06-06 14:24:35
WindowsServer--SQL Server搭建主從同步實現讀寫分離 - 事務性分發
天才臥龍
2024-06-06 14:24:25
終於搞懂了!原來vue3中template使用ref無需.value是因爲這個
你假裝沒察覺
2024-06-06 14:24:14
調試chatglm4代碼
張博的博客
2024-06-06 14:22:54
記一次 .NET某工控視覺自動化系統 卡死分析
一線碼農
2024-06-06 14:18:44
k8s組件和網絡插件掛掉,演示已有的pod是否正常運行
馬昌偉
2024-06-06 14:16:54
創建一條隧道網絡,進行傳輸的時候,是否是轉換爲物理網卡IP進行通信? k8s組件和網絡插件掛掉,演示已有的pod是否正常運行
馬昌偉
2024-06-06 14:16:54
aecmap直接用地理座標系計算面積
莫小龍
2024-06-06 14:16:34
java由於越界導致的報錯
jihite
2024-06-06 14:11:03
NFS,smb和數據庫文件
81
2024-06-06 14:09:13
賽博鬥地主——使用大語言模型扮演Agent智能體玩牌類遊戲。
a1010
2024-06-06 14:08:23