Advertisement
garfunkel

Untitled

Feb 15th, 2014
311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  SELECT e.employee_id,
  2.     e.first_name||' '|| e.last_name AS name,
  3.     CONNECT_BY_ROOT e.manager_id managerID,
  4.     CONNECT_BY_ROOT (e1.first_name||' '||e1.last_name) manager,
  5.     LEVEL AS начальников,
  6.     sys_connect_by_path(e1.first_name||' '||e1.last_name, ' / ') AS MANAGER_PATH
  7.     FROM employees e
  8.     join employees e1 ON e.manager_id=e1.employee_id
  9.     CONNECT BY e.manager_id=PRIOR e.employee_id
  10.     ORDER BY name, LEVEL DESC;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement