SELECT emplid , A.CHECK_DT FROM PS_PAY_CHECK A WHERE A.PAYCHECK_STATUS = 'F' AND A.PAYCHECK_OPTION <> 'R' AND A.CHECK_DT = ( SELECT MAX(A1.CHECK_DT) FROM PS_PAY_CHECK A1 WHERE A1.EMPLID = A.EMPLID AND A1.PAYCHECK_STATUS = 'F' AND A1.PAYCHECK_OPTION <> 'R') AND A.COMPANY = ( SELECT MAX(A5.COMPANY) FROM PS_PAY_CHECK A5 WHERE A5.EMPLID = A.EMPLID AND A5.PAYCHECK_STATUS = 'F' AND A5.PAYCHECK_OPTION <> 'R' AND A5.CHECK_DT = A.CHECK_DT) AND A.SEPCHK = ( SELECT MIN(A2.SEPCHK) FROM PS_PAY_CHECK A2 WHERE A2.EMPLID = A.EMPLID AND A2.COMPANY = A.COMPANY AND A2.PAYCHECK_STATUS = 'F' AND A2.PAYCHECK_OPTION <> 'R' AND A2.CHECK_DT = A.CHECK_DT) AND A.FORM_ID = ( SELECT MIN(A3.FORM_ID) FROM PS_PAY_CHECK A3 WHERE A3.EMPLID = A.EMPLID AND A3.COMPANY = A.COMPANY AND A3.PAYCHECK_STATUS = 'F' AND A3.PAYCHECK_OPTION <> 'R' AND A3.CHECK_DT = A.CHECK_DT AND A3.SEPCHK = A.SEPCHK) AND A.PAYCHECK_NBR = ( SELECT MAX(A4.PAYCHECK_NBR) FROM PS_PAY_CHECK A4 WHERE A4.EMPLID = A.EMPLID AND A4.COMPANY = A.COMPANY AND A4.PAYCHECK_STATUS = 'F' AND A4.PAYCHECK_OPTION <> 'R' AND A4.CHECK_DT = A.CHECK_DT AND A4.SEPCHK = A.SEPCHK AND A4.FORM_ID = A.FORM_ID)
|