SELECT A.HRS_PERSON_ID , CASE WHEN D.HRS_ROW_UPD_DTTM > A.HRS_ROW_UPD_DTTM AND D.HRS_ROW_UPD_DTTM > C.HRS_ROW_UPD_DTTM THEN D.HRS_ROW_UPD_DTTM WHEN C.HRS_ROW_UPD_DTTM > A.HRS_ROW_UPD_DTTM AND C.HRS_ROW_UPD_DTTM > D.HRS_ROW_UPD_DTTM THEN C.HRS_ROW_UPD_DTTM ELSE A.HRS_ROW_UPD_DTTM END FROM PS_HRS_APPLICANT A , PS_HRS_STS_APP_I B , PS_HRS_APP_NAMES C , PS_HRS_RCMNT D WHERE A.STATUS_CODE = B.STATUS_CODE AND A.HRS_PERSON_ID = C.HRS_PERSON_ID AND A.HRS_PERSON_ID = D.HRS_PERSON_ID AND D.HRS_RCMNT_ID = ( SELECT MAX(D2.HRS_RCMNT_ID) FROM PS_HRS_RCMNT D2 WHERE D2.HRS_PERSON_ID = D.HRS_PERSON_ID) AND D.HRS_LOGICAL_DELETE = 'N'
|