OracleOrSqlServer 递归查询

with  subqry(id,name,pid) as( select PermissionInfoId id,pmscName name,parentPmsid pid from PermissionInfo  where PermissionInfoId=23 union all select  PermissionInfoId id,PmsCName name,ParentPmsId pid from PermissionInfo ,subqry where PermissionInfo.ParentPmsId=subqry.id) select * from subqry;

---Oracle版本

select * from tbtest   start with    id=1 connect by  prior  id=pid;

原文地址:https://www.cnblogs.com/tanbin1766/p/3111720.html