top of page

SQL query to Get the Payroll Frequency and Name of any Employee

Updated: May 5, 2023


Below query will give the Employee details with the Payroll Relationship details assigned to them.


SELECT peo.PERSON_NUMBER,
       per_name.FULL_NAME,
       pay.PERIOD_TYPE as PAYROLL_FREQUENCY,
       pay.PAYROLL_NAME
FROM per_all_people_f peo,
per_all_assignments_f asg,
per_person_names_f per_name,
pay_rel_groups_dn payrel,
pay_assigned_payrolls_dn papd,
pay_all_payrolls_f pay
WHERE asg.person_id = peo.person_id
AND per_name.person_id = peo.person_id
AND asg.assignment_id = payrel.assignment_id
AND papd.payroll_term_id = payrel.parent_rel_group_id
AND papd.payroll_id = pay.payroll_id
AND payrel.group_type = 'A'
AND asg.primary_flag = 'Y'
AND asg.assignment_type = 'E'
AND asg.assignment_status_type = 'ACTIVE'
AND per_name.name_type = 'GLOBAL'
AND TRUNC (SYSDATE) BETWEEN peo.effective_start_date AND peo.effective_end_date
AND TRUNC (SYSDATE) BETWEEN asg.effective_start_date AND asg.effective_end_date
AND TRUNC (SYSDATE) BETWEEN per_name.effective_start_date AND per_name.effective_end_date
AND TRUNC (SYSDATE) BETWEEN payrel.start_date AND payrel.end_date
AND TRUNC (SYSDATE) BETWEEN papd.start_date AND NVL (papd.lspd,TO_DATE ('31/12/4712', 'DD/MM/YYYY'))
AND TRUNC (SYSDATE) BETWEEN pay.effective_start_date(+) AND pay.effective_end_date(+)
order by peo.person_number

Look forward for some more queries to come up.

Comments


bottom of page