Tree 通过父id找所有子节点
//TableName 表名 ParentID 父节点 ; WITH ret AS(SELECT * FROM SysBest_Role WHERE ID = Parentid UNION ALL SELECT t.* FROM TableName t INNER JOIN ret r ON t.ParentID = r.ID) SELECT * FROM ret w
//TableName 表名 ParentID 父节点 ; WITH ret AS(SELECT * FROM SysBest_Role WHERE ID = Parentid UNION ALL SELECT t.* FROM TableName t INNER JOIN ret r ON t.ParentID = r.ID) SELECT * FROM ret w