I write a recursive query. Problem: a recursive query that show chain management employees that leads to a particular employee('Maria Cameron' with empid=8).Output should be like this:
and my query is here:
with Managers as
(
SELECT empid, mgrid, firstname,lastname
FROM HR.Employees as h
where mgrid IS NULL
UNION ALL
SELECT e.empid,e.mgrid,e.firstname,e.lastname
FROM HR.Employees as e INNER JOIN Managers m
ON (e.mgrid = m.empid)
)
SELECT *
FROM Managers
where firstname='Maria' and lastname='Cameron' and empid=8

