`
阅读更多
create table test
      (ID        NUMBER(18) not null,
       name      vaechar2(50),
       parent_id NUMBER(18)
      );

--查询当前节点下的所有子节点
  select * from test t start with t.id='当前节点ID' connect by prior t.id=t.parent_id;
--查询当前节点的父节点或者父节点以上的节点
select * from test t start with t.id='当前节点ID' connect by  t.id= prior t.parent_id;
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics