Sunday, May 19, 2013

Query to to find the Employee Supervisor name


SELECT distinct d.EMPLOYEE_NUMBER,
                d.FULL_NAME,
                a.CONCATENATED_SEGMENTS,

                a.element_name,
                decode(a.debit_or_credit, ’Debit’, COSTED_VALUE, '') Debit,
                decode(debit_or_credit, ’Credit’, COSTED_VALUE, '') Credit
  FROM pay_costs_v              a,
       pay_assignment_actions_v b,
       per_assignments_x        c,
       per_people_x             d
 where d.EMPLOYEE_NUMBER = nvl(:p_emp_no, d.EMPLOYEE_NUMBER)
   and trunc(b.EFFECTIVE_DATE) between :p_from_date and :p_to_date
   and a.ASSIGNMENT_ACTION_ID = b.ASSIGNMENT_ACTION_ID
   and b.ASSIGNMENT_ID = c.ASSIGNMENT_ID
   and c.PERSON_ID = d.PERSON_ID