BIP – Query to find persons with multiple active work relationships
SELECT papf.person_number
FROM per_all_people_f papf
WHERE 1=1
AND EXISTS (SELECT 1 FROM per_periods_of_service ppos
WHERE ppos.person_id = papf.person_id
AND (ppos.actual_termination_date IS NULL or ppos.actual_termination_date>= TRUNC(SYSDATE))
GROUP BY ppos.person_id
HAVING COUNT (ppos.period_of_service_id) >1
)