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;

 

posted @ 2013-06-01 00:53  Zak.Tan  阅读(178)  评论(0编辑  收藏  举报