oracle查询父节点及其下所有子节点
1.我们的组织机构就是这种树形菜单的格式。
.
2.执行sql:
select
( select organization_name from SYS_ORGANIZATION where organization_id =x.organization_id) organization_name,
c.organization_id
from SYS_ORGANIZATION c, (select organization_id from SYS_ORGANIZATION where parent_id = '1') x where x.organization_id = c.organization_id or x.organization_id = c.parent_id start with c.organization_id =x.organization_id
connect by prior c.organization_id = c.parent_id
效果:
3.执行sql:
select organization_name,wmsys.wm_concat(organization_id ) organization_ids from
(select
( select organization_name from SYS_ORGANIZATION where organization_id =x.organization_id) organization_name,
c.organization_id
from SYS_ORGANIZATION c, (select organization_id from SYS_ORGANIZATION where parent_id = '1') x where x.organization_id = c.organization_id or x.organization_id = c.parent_id start with c.organization_id =x.organization_id
connect by prior c.organization_id = c.parent_id ) a group by organization_name
效果:
4.执行sql:
select a.organization_name,count(c.organization_id) sum from
(select organization_name,wmsys.wm_concat(organization_id ) organization_ids from
(select
( select organization_name from SYS_ORGANIZATION where organization_id =x.organization_id) organization_name,
c.organization_id
from SYS_ORGANIZATION c, (select organization_id from SYS_ORGANIZATION where parent_id = '1') x where x.organization_id = c.organization_id or x.organization_id = c.parent_id start with c.organization_id =x.organization_id
connect by prior c.organization_id = c.parent_id ) a group by organization_name ) a left join
(select c.clxxbh,c.organization_id from v_wfxx c left join BIZ_IMPORTANT_PLACES z on c.kkmc = z.place_name left join SYS_ORGANIZATION c on z.place_unit = c.organization_id) c
on instr(a.organization_ids,c.organization_id) > 0 group by a.organization_name
效果:
oracle查询父节点及其下所有子节点的更多相关文章
- postgre 查询同表中的,该节点写的所有子节点
SELECT catalogid, foldername, parentid, folderpath FROM public.ic_catalog; --查询同表中的,该节点写的所有子节点 WITH ...
- JQuery/JS插件 jsTree加载树,预先加载,初始化时加载前三级节点,当展开第三级节点时 就加载该节点下的所有子节点
jsTree加载树, 初始化时 加载前三级节点, 当展开第三级节点时 就加载该节点下的所有子节点 html: <!DOCTYPE html> <html> <head&g ...
- SQL查询父节点下的所有子节点(包括子节点下的子节点,无限子节点)
-->Title:Generating test data -->Author:wufeng4552 -->Date :2009-09-30 08:52:38 set nocount ...
- easyui Tree模拟级联勾选cascadeCheck,节点选择,父节点自动选中,节点取消,父节点自动取消选择,节点选择,所有子节点全部选择,节点取消,所有子节点全部取消勾选
最近项目中用到easyui tree,发现tree控件的cascadeCheck有些坑,不像miniui 的tree控件,级联勾选符合业务需求,所以就自己重新改写了onCheck事件,符合业务需求.网 ...
- mysql下如何删除本节点下的所有子节点小记
在开发过程中,经常会遇到树形结构的数据,在删除某个节点时候其所有的子节点都要被删除,可以使用如下方法: 1.添加记录该节点所有父节点的ID的字段(parent_ids),并用逗号隔开(一定是逗号),如 ...
- sqlserver查询指定树形结构的所有子节点
用标准sql的with实现递归查询(sql2005以上肯定支持,sql2000不清楚是否支持): with subqry(id,name,pid) as ( select id,name,pid fr ...
- Extjs4.x Ext.tree.Panel 遍历当前节点下的所有子节点
Ext.define('WMS.controller.Org', { extend: 'Ext.app.Controller', stores: ['OrgUser', 'OrgTree'], mod ...
- MySQL中进行树状所有子节点的查询 . mysql根据父id 查询所有的子id
在Oracle 中我们知道有一个 Hierarchical Queries 通过CONNECT BY 我们可以方便的查了所有当前节点下的所有子节点.但很遗憾,在MySQL的目前版本中还没有对应的功能. ...
- MySQL中进行树状所有子节点的查询
在Oracle 中我们知道有一个 Hierarchical Queries 通过CONNECT BY 我们可以方便的查了所有当前节点下的所有子节点.但很遗憾,在MySQL的目前版本中还没有对应的功能. ...
随机推荐
- 第三十三天- 线程创建、join、守护线程、死锁
1.线程,线程创建 概念:在传统操作系统中,每个进程有一个地址空间,而且默认就有一个控制线程,线程顾名思义,就是一条流水线工作的过程,一条流水线必须属于一个车间,一个车间的工作过程是一个进程,车间负责 ...
- ES6--JavaScript的第六个版本
一.新的变量声明方式 let/cons 与var不同,新的变量声明方式带来了一些不一样的特性,其中最重要的两个特性就是提供了块级作用域与不再具备变量提升. 若是对变量提升不怎么了解的话可以去参考我的其 ...
- 原生css 中变量的使用
前两天看到阮大神的一篇在css中使用变量的文章,整理了一下. 这个重要的 CSS 新功能,所有主要浏览器已经都支持了.本文全面介绍如何使用它,你会发现原生 CSS 从此变得异常强大. 一.变量的声明 ...
- 【读书笔记】iOS-网络-错误处理的经验法则
一,在接口契约中处理错误. 二,错误状态可能不正确. 设备模糊地确认操作是崇拜失败的.比如,移动应用发出HTTP请求以在两个账户间转账.请求被银行系统接收并正确地处理:然而,由于网络失败应答却丢失了, ...
- Echarts图表常用功能配置,Demo示例
先看下效果图: 就如上图所示,都是些常用的基本配置. Legend分页,X轴设置,Y轴设置,底部缩放条设置, 数值显示样式设置,工具箱设置,自定义工具按钮, 绑定点击事件等等.这些配置代码中都做了简单 ...
- Linux服务器redhat配置本地yum源
前面给大家介绍了很多在Linux安装软件的知识,这些软件往往依赖了很多第三方的工具或者软件,如果在Linux服务器有外网的情况,咱们可以通过yum install这样的命令直接去安装这些相关的工具或者 ...
- JAVAEE——SSH项目实战01:SVN介绍、eclipse插件安装和使用方法
1 学习目标 1.掌握svn服务端.svn客户端.svn eclipse插件安装方法 2.掌握svn的基本使用方法 2 svn介绍 2.1 项目管理中的版本控制问题 通常软件开发由多人协作开发,如果对 ...
- oracle 定义临时变量,并使用分支判断
declare tempCount int; tempID ); begin select count(*) into tempCount from CUSTOMER_PROFILE where id ...
- SpringBoot_Mybatis_Maven_BootStrap
需要eclipse 配置maven 未完,待续 链接:https://pan.baidu.com/s/1vej2zEdJmKeMUJD9S1B5MA 密码:y5j9
- Google搜索引擎
一.基本搜索 逻辑符 与(空格).或(OR).非(-). ""全匹配搜索 加入双引号表示完全匹配搜索 *通配符 二.高级搜索 intitle:只搜索网页标题(即html的title ...