SQL query to get the list of supervisor hierarchy. employee --> supervisor --> supervisor

后端 未结 2 1827
广开言路
广开言路 2021-01-23 14:14

I have two tables Employee and Department this image shows the manager of every employee. I want to write a SQL query that gives me a list of all the supervisor (Mana

2条回答
  •  不要未来只要你来
    2021-01-23 15:03

    I think you can use "hierarchical queries" for Oracle and try this:

    select manager_id supervisor 
    from employee
    start with employee_id = 202
    connect by nocycle employee_id = prior manager_id;
    

提交回复
热议问题