LifespanWriter
Technical User
I'm working on a report to show any employees in a given time period who have at least 2 earning codes (ERNCD) listed in Additional Pay Data in that period. I currently have it showing all employees with addition pays in that period, and have it grouped by employee ID to show the count of ERNCD's for each employee, but I can't seem to get it to only show those employees with >1 ERNCD's... any suggestions? This is what the SQL looks like:
SELECT DISTINCT
"C"."COMPANY", "C"."PAYGROUP", "SYSADM"."PS_PERSONAL_DATA"."NAME", "F"."EMPLID", "F"."ERNCD", "F"."HOURLY_RT", "F"."OTH_HRS", "F"."OTH_PAY", "F"."EARNINGS_END_DT", "F"."EFFDT", "F"."ADDL_SEQ", "F"."DED_TAKEN", "F"."SEPCHK", "F"."OK_TO_PAY", "F"."GOAL_AMT"
FROM
"SYSADM"."PS_JOB" "C", "SYSADM"."PS_PERSONAL_DATA", "SYSADM"."PS_ADDL_PAY_DATA" "F"
WHERE
((("F"."EFFDT" BETWEEN <<DATE1, "TO_DATE('"yyyy"-"mm"-"dd"', 'YYYY-MM-DD')">> AND <<DATE2, "TO_DATE('"yyyy"-"mm"-"dd"', 'YYYY-MM-DD')">>) AND
("F"."ERNCD" <> 'FL') AND
("C"."EFFDT" = (Select max(B.EFFDT)from sysadm.ps_job B where C.EMPLID=B.EMPLID))))
AND
("C"."EMPLID" = "SYSADM"."PS_PERSONAL_DATA"."EMPLID" ) AND ("C"."EMPLID" = "F"."EMPLID" )
ORDER BY
"C"."COMPANY", "SYSADM"."PS_PERSONAL_DATA"."NAME"
Richard Sanders
Payroll/HR Systems Specialist
Lifespan Corporate Services
Providence, RI
SELECT DISTINCT
"C"."COMPANY", "C"."PAYGROUP", "SYSADM"."PS_PERSONAL_DATA"."NAME", "F"."EMPLID", "F"."ERNCD", "F"."HOURLY_RT", "F"."OTH_HRS", "F"."OTH_PAY", "F"."EARNINGS_END_DT", "F"."EFFDT", "F"."ADDL_SEQ", "F"."DED_TAKEN", "F"."SEPCHK", "F"."OK_TO_PAY", "F"."GOAL_AMT"
FROM
"SYSADM"."PS_JOB" "C", "SYSADM"."PS_PERSONAL_DATA", "SYSADM"."PS_ADDL_PAY_DATA" "F"
WHERE
((("F"."EFFDT" BETWEEN <<DATE1, "TO_DATE('"yyyy"-"mm"-"dd"', 'YYYY-MM-DD')">> AND <<DATE2, "TO_DATE('"yyyy"-"mm"-"dd"', 'YYYY-MM-DD')">>) AND
("F"."ERNCD" <> 'FL') AND
("C"."EFFDT" = (Select max(B.EFFDT)from sysadm.ps_job B where C.EMPLID=B.EMPLID))))
AND
("C"."EMPLID" = "SYSADM"."PS_PERSONAL_DATA"."EMPLID" ) AND ("C"."EMPLID" = "F"."EMPLID" )
ORDER BY
"C"."COMPANY", "SYSADM"."PS_PERSONAL_DATA"."NAME"
Richard Sanders
Payroll/HR Systems Specialist
Lifespan Corporate Services
Providence, RI