SQL 迭代查询语句

时间:2017-09-30 15:46:26   收藏:0   阅读:271

SQL迭代查询 PL/SQL

with ORG_Tree(ObjectId,parentID) 
as
(
    select a.ObjectId,a.parentID from Ot_Organizationunit a where Name in (212江苏区域,225浙江区域,260苏州区域,217沪苏区域)
    Union ALL
    select b.ObjectId,b.parentID from Ot_Organizationunit b inner join ORG_Tree T on b.parentID=T.ObjectID
)
select ouser.Name,ouser.code from OT_User ouser inner join ORG_Tree ot on ouser.parentid=ot.ObjectID

 

原文:http://www.cnblogs.com/wangfuyou/p/7615020.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!