--根据指定节点ID获取所有子节点-- WITH TEMP AS ( SELECT * FROM table_name WHERE Id=' --表的主键ID UNION ALL SELECT T0.* FROM TEMP,table_name T0 WHERE TEMP.Id=T0.ParentId --子级ID==父级ID ) SELECT * FROM TEMP; --根据指定节点ID获取所有父节点-- WITH TEMP AS ( SELECT * FROM table_name WHE
--根据指定节点ID获取所有子节点-- WITH TEMP AS ( ' --表的主键ID UNION ALL SELECT T0.* FROM TEMP,table_name T0 WHERE TEMP.Id=T0.ParentId --子级ID==父级ID ) SELECT * FROM TEMP; --根据指定节点ID获取所有父节点-- WITH TEMP AS ( ' --表的主键ID UNION ALL SELECT T0.* FROM TEMP,table_name T0 WHERE