Tuesday, March 10, 2015

Query to to find the Employee Supervisor name

SELECT
papf1.full_name supervisor_name
From apps.per_all_people_f papf,
apps.per_all_assignments_f paaf,
apps.per_all_people_f papf1
WHERE papf.person_id = paaf.person_id
AND paaf.primary_flag = ‘Y’
AND paaf.assignment_type = ‘E’
AND paaf.supervisor_id = papf1.person_id
AND papf1.current_employee_flag = ‘Y’
AND papf.business_group_id = paaf.business_group_id
AND SYSDATE BETWEEN papf.effective_start_date
and papf.effective_end_dateAND SYSDATE BETWEEN paaf.effective_start_date AND paaf.effective_end_date
AND SYSDATE BETWEEN papf1.effective_start_date AND papf1.effective_end_date
AND papf.employee_number = :p_emp_number;

No comments:

Post a Comment