...

SQL Sample Statement

Retrieve employee headcount as of today.

  SELECT
    COUNT(1)
FROM
    per_person_secured_list_v     ppf,
    per_assignment_secured_list_v paam,
    per_periods_of_service        pps,
    per_person_type_usages_f      pptu
WHERE
        1 = 1
    AND ppf.person_id = paam.person_id
    AND paam.period_of_service_id = pps.period_of_service_id
    AND paam.person_id = pptu.person_id
    AND paam.assignment_status_type = 'ACTIVE'
    AND paam.assignment_type = 'E'
    AND paam.effective_latest_change = 'Y'
    AND pps.primary_flag = 'Y'
    AND pptu.system_person_type IN ( 'EMP' )
    AND sysdate BETWEEN ppf.effective_start_date AND ppf.effective_end_date
    AND sysdate BETWEEN paam.effective_start_date AND paam.effective_end_date
    AND sysdate BETWEEN pps.date_start AND nvl(pps.actual_termination_date, TO_DATE('4712-12-31', 'YYYY-MM-DD'))

  
Seraphinite AcceleratorBannerText_Seraphinite Accelerator
Turns on site high speed to be attractive for people and search engines.