一个简单的树查询

SQL> select * from treeview;

PARENT     CHILD
---------- ----------
a          b
a          c
a          e
b          b1
b          b2
c          c1
e          e1
e          e3
c          e

9 rows selected.

SQL> select * from treeview start with parent='c' connect by child=parent;

PARENT     CHILD
---------- ----------
c          c1
c          e

SQL> select * from treeview start with parent='c' connect by prior child=parent;

PARENT     CHILD
---------- ----------
c          c1
c          e
e          e1
e          e3

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/12361284/viewspace-604/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/12361284/viewspace-604/

你可能感兴趣的:(一个简单的树查询)