SELECT A.SSR_BR_INDEX_ID ,A.SSR_BR_MSGUUID ,A.INSTITUTION ,A.SSR_RIO_PRG_UUID ,A.SSR_RI_AT_TVAL_NLD ,A.SSR_RI_EPV_COD_NLD ,A.SSR_RI_OLO_COD_NLD , A.SSR_BR_TRANS_DTTM ,( SELECT COUNT(*) FROM %Table(SSR_RI_ER_NLD) B WHERE A.SSR_BR_INDEX_ID =B.SSR_BR_INDEX_ID AND A.SSR_BR_MSGUUID=B.SSR_BR_MSGUUID )"ERRORS" FROM %Table(SSR_RI_OPR_NLD) A WHERE A.SSR_BR_TRANS_STAT IN ('S' ,'T') AND NOT EXISTS ( SELECT 'X' FROM %Table(SSR_RI_EROP_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_RIO_PRG_UUID =A.SSR_RIO_PRG_UUID AND B.INSTITUTION=A.INSTITUTION AND B.REJECT_FLAG='S' ) AND A.SSR_BR_TRANS_DTTM = ( SELECT MAX(C.SSR_BR_TRANS_DTTM) FROM %Table(SSR_RI_OPR_NLD) C WHERE C.SSR_RIO_PRG_UUID=A.SSR_RIO_PRG_UUID AND C.INSTITUTION=A.INSTITUTION ) GROUP BY A.SSR_BR_INDEX_ID,A.SSR_BR_MSGUUID,A.INSTITUTION, A.SSR_RIO_PRG_UUID,A.SSR_RI_AT_TVAL_NLD, A.SSR_RI_EPV_COD_NLD,A.SSR_RI_OLO_COD_NLD, A.SSR_BR_TRANS_DTTM
|