select ID from 表名start with id 節點id connect by prior parentid id 其中id為表中id標識,parentid為父節點id標識 ...
2018-06-13 14:36 0 865 推薦指數:
create table #EnterPrise ( Department nvarchar(50),--部門名稱 ParentDept nvarchar(50),--上級部門 DepartManage nvarchar(30)--部門經理 ) insert ...
原文參考:https://blog.csdn.net/smartsmile2012/article/details/81317327 ...
-- MySql 獲取當前節點及遞歸所有上級節點 -- 參數說明:resultField:查詢返回字段,idd 要查詢的資源ID值,idFieldName ID字段名,parentIdFieldName 上級ID字段名,tableName 表名,isContainMySelf 是否 ...
-- 查找所有父節點with tab as( select Type_Id,ParentId,Type_Name from Sys_ParamType_V2_0 where Type_Id=316--子節點 union all select b.Type_Id,b.ParentId ...
-- 查找所有父節點with tab as( select Type_Id,ParentId,Type_Name from Sys_ParamType_V2_0 where Type_Id=316--子節點 union all select b.Type_Id,b.ParentId ...
SBP_ORG_DEPT表結構如下: MySQL用函數 也可解決這種需求問題。 group_concat 不適用數據較多的時候。 函數getParentNodesFromChil ...