Q: SELECT with LEVEL [message #372552] |
Thu, 22 February 2001 02:22 |
Jonas
Messages: 6 Registered: February 2001
|
Junior Member |
|
|
Hello,
Following qyery:
SELECT LPAD(' ',2*(LEVEL-1)) ename org_chart, empno, mgr, job
FROM emp
START WITH job = 'PRESIDENT'
CONNECT BY PRIOR empno = mgr;
Returns:
ORG_CHART EMPNO MGR JOB
--------------- --------------- --------------- ---------------
KING 1 PRESIDENT
JONES 2 1 MANAGER
SCOTT 3 2 ANALYST
ADAMS 4 3 PROGRAMMER
FORD 5 2 ANALYST
SMITH 6 5 PROGRAMMER
BLAKE 7 1 MANAGER
ALLEN 8 7 SALESMAN
WARD 9 7 SALESMAN
MARTIN 10 7 SALESMAN
This is fine, but how do I make the Query so it only returns one of the emloyees title (DISTINCT) under the Manager Blake ?
Hope you understand what I mean.
Regards, Jonas
|
|
|
|