--通过父节点查询子节点 WITH TREE AS( SELECT * FROM Role WHERE RoleID = 4 -- 要查询的父 id UNION ALL SELECT Role.* FROM Role, TREE WHERE Role.ParentRoleID = TREE.RoleID ) SELECT * FROM TREE
--通过父节点查询子节点 WITH TREE AS( SELECT * FROM Role WHERE RoleID = 4 -- 要查询的父 id UNION ALL SELECT Role.* FROM Role, TREE WHERE Role.ParentRoleID = TREE.RoleID ) SELECT * FROM TREE