0
(
    select 
      ppnf_sup.full_name 
    FROM 
      per_all_people_f papf_sup, 
      per_person_names_f ppnf_sup, 
      per_assignment_supervisors_f pasf1 
    where 
      1 = 1 
      and papf_sup.person_id = ppnf_sup.person_id 
      AND ppnf_sup.person_id = pasf1.manager_id 
      AND pasf1.assignment_id = paam.assignment_id 
      AND pasf1.primary_flag = 'Y' 
      AND pasf1.manager_type = 'LINE_MANAGER' 
      AND ppnf_sup.name_type = 'GLOBAL' 


   AND MIN(  papf_sup.effective_start_date, -1 ) AND  papf_sup.effective_end_date 

   AND MIN(  pasf1.effective_start_date ,  -1 )   AND pasf1.effective_end_date
   AND ppnf_sup.effective_end_date = (select MIN(ppnf_sup1.effective_start_date)-1)

      FROM 
      per_all_people_f papf_sup1, 
      per_person_names_f ppnf_sup1, 
      per_assignment_supervisors_f pasf2 
    where 
      1 = 1 
      and papf_sup1.person_id = ppnf_sup1.person_id 
      AND ppnf_sup1.person_id = pasf2.manager_id 
      AND pasf2.assignment_id = paam.assignment_id 
      AND pasf2.primary_flag = 'Y' 
      AND pasf2.manager_type = 'LINE_MANAGER' 
      AND ppnf_sup1.name_type = 'GLOBAL' 
  AND trunc(sysdate) BETWEEN papf_sup1.effective_start_date AND papf_sup1.effective_end_date 
 AND trunc(sysdate) BETWEEN pasf2.effective_start_date AND pasf2.effective_end_date
  group by person_id

)   prev_Sup_name,

How can I achieve this code works for previous data like curr job title is SR manager and prev job title was manager?

2
  • Your question is not clear and not even logic of the query. Please edit the question and share sample data, expected output, somewhat table structures.
    – Popeye
    Commented Oct 18, 2019 at 13:02
  • Also you forgot to include per_all_assigments_m which is required to map person and supervisor
    – Popeye
    Commented Oct 18, 2019 at 13:07

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.