我思故我强

oracle递归查询语句

oracle递归查询语句
表结构:表 fso_sdept, 字段 dept_id(部门ID)、dept_name(部门名称)、dept_p_id(父部门ID)

包含父部门和子部门
select dept_id,dept_name from fso_sdept where dept_stat=1
start with dept_id=1129 connect by prior dept_id=dept_p_id

不包含父部门只包含子部门
select dept_id,dept_name from fso_sdept where dept_stat=1
start with dept_p_id=1129  connect by prior dept_id=dept_p_id

posted on 2007-12-25 10:06 李云泽 阅读(622) 评论(0)  编辑  收藏 所属分类: Oracle


只有注册用户登录后才能发表评论。


网站导航: