SELECT A.EMPLID , A.COMPANY , A.EMPL_RCD , A.EFFDT , A.PAYGROUP FROM PS_PRIM_PAYGRP0_VW A WHERE A.EFFDT = ( SELECT MIN(A1.EFFDT) FROM PS_PRIM_PAYGRP0_VW A1 WHERE A1.EMPLID = A.EMPLID AND A1.EMPL_RCD = A.EMPL_RCD AND A1.COMPANY = A.COMPANY) UNION SELECT B.EMPLID , B.COMPANY , B.EMPL_RCD , B.EFFDT , B.PAYGROUP FROM PS_JOB B WHERE B.EFFDT = ( SELECT MAX(B1.EFFDT) FROM PS_JOB B1 WHERE B1.EMPLID = B.EMPLID AND B1.EMPL_RCD = B.EMPL_RCD AND B1.COMPANY = B.COMPANY AND B1.EFFDT <= %CurrentDateIn) AND B.EFFSEQ = ( SELECT MAX(B2.EFFSEQ) FROM PS_JOB B2 WHERE B2.EMPLID = B.EMPLID AND B2.EMPL_RCD = B.EMPL_RCD AND B2.EFFDT = B.EFFDT AND B2.COMPANY = B.COMPANY)
|