Hierarchical query:
This query lists the employee_details with their manager in hierarchical manner from employees table.
SELECT a.employee_id, a.first_name, a.last_name, a.manager_id,
b.first_name mgr_first_name, b.last_name mgr_last_name
FROM
(
select employee_id, first_name, last_name, manager_id
from employees
start with employee_id = 100
connect by prior employee_id = manager_id
) a,
employees b
WHERE a.manager_id = b.employee_id(+)
Regards,
Khwaja
Thursday, January 25, 2007
Subscribe to:
Post Comments (Atom)






No comments:
Post a Comment