Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Sorting hierarchical query
Hi.
Consider the employees table, where each record contains the id number
and the name of an
employee, and, in addition, the id number of the employee's manager:
create table EMP (
EMPNO number(4),
ENAME varchar2(100),
MGR number(4) );
I select the employees' tree by:
select EMPNO,ENAME
from EMP
connect by prior EMPNO = MGR;
(never mind the tree-shape displaying now).
Now, I need to improve this query so all the employees with the same
manager will be ordered by
ENAME.
Does anyone has an idea how to do that ?
(The SELECT must be in SQL. However, using PL/SQL functions within the
query is allowed).
Thanks.
-- ==================================================== Oren Nakdimon Golden Screens Ltd. address: 17 Abba-Hillel st., Ramat-Gan 52522, ISRAEL email: oren_at_gsit.co.il tel: +972-3-7510836 fax: +972-3-7518221 ====================================================Received on Sat Nov 08 1997 - 00:00:00 CST
![]() |
![]() |