hierachical query to return final row
- by jeff
I have a hierarchical query that doesn't return an expected row (employee badge = 444).
TABLE: hr_data
badge fname supervisor_badge
111 Jeff 222
222 Joe 333
333 John 444
444 Tom 444
SQL:
SELECT CONNECT_BY_ISCYCLE As IC,
badge,
fname,
supervisor_badge
FROM hr_data
START WITH badge = '111'
CONNECT BY NOCYCLE badge = PRIOR supervisor_badge
What is Returned:
IC badge fname supervisor_badge
0 111 Jeff 222
0 222 Joe 333
1 333 John 444
What is Expected:
IC badge fname supervisor_badge
0 111 Jeff 222
0 222 Joe 333
**0** 333 John 444
**1** 444 Tom 444
How can I get this query to return the employee Tom and then stop?