Du kunne gøre noget som dette:
SQL> SELECT *
2 FROM (SELECT empl_id, ename, report_to,
3 member_id, board_position,
4 MAX(lvl) over(PARTITION BY empl_id) maxlvl, lvl
5 FROM (SELECT connect_by_root(e.empl_id) empl_id,
6 connect_by_root(e.ename) ename,
7 bm.empl_id report_to,
8 LEVEL lvl, bp.*
9 FROM emp e
10 LEFT JOIN board_members bm
11 ON e.empl_id = bm.empl_id
12 LEFT JOIN board_positions bp
13 ON bm.member_id = bp.member_id
14 CONNECT BY NOCYCLE e.empl_id = PRIOR e.report_to
15 AND (PRIOR bp.board_position IS NULL
16 OR PRIOR bp.board_position != 'LDRSHPCOMM')))
17 WHERE lvl = maxlvl;
EMPL_ID ENAME REPORT_TO MEMBER_ID BOARD_POSITION
------- -------------------------------- --------- --------- ------------------
FLUNKY Ida Dunnit INFGUY CIO LDRSHPCOMM
HITECH Number 2 INFGUY CIO LDRSHPCOMM
INFGUY Comp U Turk INFGUY CIO LDRSHPCOMM
LOTECH Number 3 INFGUY CIO LDRSHPCOMM
OPSGUY Meikut Work OPSGUY COO LDRSHPCOMM
PROGMR Nameless Blameless INFGUY CIO LDRSHPCOMM
TOPDOG Big Guy TOPDOG CEO LDRSHPCOMM
WALLET Money Bags WALLET CFO LDRSHPCOMM
Jeg har ingen START WITH-klausul, fordi jeg vil starte den hierarkiske forespørgsel for alle medarbejdere. For hver medarbejder går jeg gennem de hierarkiske data, indtil jeg finder en leder, der er bestyrelsesmedlem i ledelsesudvalget (CONNECT BY-klausul).
De ydre forespørgsler filtrerer de relevante linjer.