树结构数据查询
来源:互联网 发布:软件样本捕获 编辑:程序博客网 时间:2024/04/29 18:22
一 、sql server 2008 树结构数据查询:
;WITH MenuTree AS(
SELECT 1 as level, menu_id as id , mtext as name, url,
parent_id as parentId, status, creator as creatorId,
create_time as createdTime, last_modifier as lastModifierId,
1 AS Generation,cast(menu_id as varchar(20)) as path FROM sys_pri_menu
WHERE PARENT_ID =0
UNION ALL
SELECT Generation + 1 as level, Menu.menu_id as id ,
Menu.mtext as name, Menu.url, Menu.parent_id as parentId,
Menu.status, Menu.creator as creatorId, Menu.create_time as createdTime,
Menu.last_modifier as lastModifierId, Generation + 1,cast(MenuTree.path+'/'+cast(Menu.menu_id as varchar(20)) as varchar(20))
FROM sys_pri_menu AS Menu INNER JOIN
MenuTree ON Menu.PARENT_ID = MenuTree.id where 2 > 1 and Menu.status = 0 )
SELECT mt.* FROM MenuTree mt order by path
二、oracle树数据结构查询
select level,
t.menu_id as id ,
t.mtext as name,
t.sub_system as subSystem,
t.url,
t.parent_id as parentId,
t.status,
t.creator as creatorId,
t.create_time as createdTime,
t.last_modifier as lastModifierId,
t.last_modified as lastModified
from sys_pri_menu t
where 2 > 1 and t.status = 0 and t.SUB_SYSTEM = 2
start with t.parent_id=0 connect by prior t.menu_id=t.parent_id
- 查询树结构数据
- 树结构数据查询
- 查询属性结构数据
- Mysql查询树形结构数据
- Oracle start with .... connect by 查询树结构数据
- 关于树型结构数据递归查询,转非递归查询的实现
- 树结构查询
- 树结构的查询
- 树结构递归查询
- ORACLE - 树结构查询
- SQL查询树结构
- 树结构查询
- SQL查询树结构
- Oracle树结构查询
- ORACLES树结构查询
- Oracle 树结构查询
- 树结构表查询
- oracle 树结构查询
- Simple calculations(数学都不会了)
- YUV420SP
- 【xtku】教你巧用库完成照片搜索
- Median of Two Sorted Arrays
- ubuntu下android设备连接出现error: insufficient permissions for device 错误
- 树结构数据查询
- 安卓开发自定义弹出框的简单方式(纯代码布局)
- 如何设置Matlab输出到Word中图片的大小
- android监听键盘事件KeyEvent
- 内存管理1retain和release
- TestNG 教程2 – 期待异常测试
- Times33算法与最快的Hash表
- Command命令模式
- 数据结构之循环队列