Home > Database > Mysql Tutorial > Oracle 层级语句 树形结构 显示根节点 不显示根节点

Oracle 层级语句 树形结构 显示根节点 不显示根节点

WBOY
Release: 2016-06-07 15:20:12
Original
1734 people have browsed it

.Oracle 层级语句 树形结构 area_id 就是普通的主键ID 与parent_id 对应..行政区划表 1.start with t.parent_id 这里为parent_id 不显示顶端根结点,这样会有多个根 select t.* from HM_F_AREA t where length(t.area_id) = 6 start with t.parent_id = '5100

.Oracle 层级语句 树形结构

area_id 就是普通的主键ID  与 parent_id 对应..行政区划表

1.  start with t.parent_id 这里为parent_id 不显示顶端根结点,这样会有多个根

select t.* from HM_F_AREA t where length(t.area_id) = 6
  start with t.parent_id = '510000'
  connect by t.parent_id = PRIOR t.area_id
Copy after login

Oracle 层级语句 树形结构 显示根节点 不显示根节点



2.start with t.id 如果为ID 就是显示根,只有一个根

select t.* from HM_F_AREA t where length(t.area_id) = 6
  start with t.area_id = '510000'
  connect by t.parent_id = PRIOR t.area_id
Copy after login
.Oracle 层级语句 树形结构 显示根节点 不显示根节点
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template