I have a table with the structure as below:
+-------+-------+ | EMPID | MGRID | +-------+-------+ | A | B | | B | C | | C | D | | I | J | | J | D | | K | L | | L | O | | O | D | +-------+-------+
I want to build a query that can create a view as below showing all manager hierarchy as columns starting with highest manager however I am not sure how this can be achieved in oracle. Can someone please help advise how to do this..
Output Desired:
+-------+-------+------+------+------+ | EMPID | MGRID | LVL1 | LVL2 | LVL3 | +-------+-------+------+------+------+ | A | B | D | C | B | | B | C | D | C | | | C | D | D | | | | I | J | D | J | | | J | D | D | | | | K | L | D | O | L | | L | O | D | O | | | O | D | D | | | +-------+-------+------+------+------+
Note: I am not sure how to add a table to the question but added it as a text so that it can be copied.