En Oracle existe la setencia START WITH and CONNECT BY, de manera que se puede hacer
SELECT child, parent, level FROM Prueba START WITH parent is null CONNECTED BY PRIOR child = parent; En SQL como sintaxis equivalente tenemos: WITH Empleados (EmployeeID, ManagerID, Level) AS ( SELECT EmployeeID, ManagerID, 1 FROM HumanResources.Employee WHERE ManagerID IS NULL UNION ALL SELECT Employee.EmployeeID, Employee.ManagerID, Empleados.Level+1 FROM HumanResources.Employee JOIN Empleados ON Empleados.EmployeeID=Employee.ManagerID ) SELECT * FROM Empleados