ITeye博客

oracle 递归查询

terryjs · 2016-05-16 11:55 · oracle · 非技术 · Markdown

oracle 递归查询

 

 

oracle递归查询
Oracle中start by prior子句用法
connect by 是结构化查询中用到的,其基本语法是:
select ... from tablename start with 条件1
connect by 条件2
where 条件3;

例:
select * from table
start with org_id = 'HBHqfWGWPy'
connect by prior org_id = parent_id;

 

//没有 where

select * from t_user t start with t.employee_no = '1' connect by prior t.id = t.parent_id;

 

//有where

select * from t_user t where  t.employee_no <> '1' start with t.employee_no = '1' connect by prior t.id = t.parent_id ;

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。