SELECT DISTINCT A.SSR_BR_INDEX_ID ,A.SSR_BR_MSGUUID ,A.SSR_BR_ENRL_SQ_NLD ,A.SAD_BR_BPV_SEQ_NLD ,A.EMPLID ,A.SSR_BR_TRANS_DTTM FROM PS_SSR_BR_BPBO_NLD A ,PS_SSR_BR_INTS_NLD B WHERE A.SSR_BR_TRANS_STAT = 'R' AND NOT EXISTS ( SELECT 'X' FROM PS_SSR_BR_ERBP_NLD B WHERE B.SSR_BR_INDEX_ID=A.SSR_BR_INDEX_ID AND B.SSR_BR_MSGUUID=A.SSR_BR_MSGUUID AND B.SSR_BR_ENRL_SQ_NLD=A.SSR_BR_ENRL_SQ_NLD AND B.SAD_BR_BPV_SEQ_NLD = A.SAD_BR_BPV_SEQ_NLD AND B.EMPLID=A.EMPLID AND B.REJECT_FLAG='R' ) AND A.SSR_BR_TRANS_DTTM = ( SELECT MAX(C.SSR_BR_TRANS_DTTM) FROM PS_SSR_BR_BPBO_NLD C WHERE C.EMPLID=A.EMPLID AND C.SSR_BR_ENRL_SQ_NLD=A.SSR_BR_ENRL_SQ_NLD AND C.SAD_BR_BPV_SEQ_NLD = A.SAD_BR_BPV_SEQ_NLD ) AND A.SSR_BR_TRANS_DTTM < %TimeAdd(%CurrentDateTimeIn, -(B.SSR_BR_HRS_RECEIVE*(60))) GROUP BY A.SSR_BR_INDEX_ID,A.SSR_BR_MSGUUID,A.SSR_BR_ENRL_SQ_NLD ,A.SAD_BR_BPV_SEQ_NLD,A.EMPLID, A.SSR_BR_TRANS_DTTM
|