SELECT DISTINCT G.OPRID , A.SCC_LETTER_CD , A.DESCR FROM PS_SCC_STN_LTR_TBL A , PS_COMM_CTXT_TBL B , PS_COMM_CTX_ME_TBL C , PS_COMM_CATG_TBL D , PS_COMM_CA_CTX_TBL E , PS_COMM_GRP_3C_TBL F , PS_OPR_GRP_3C_TBL G , PS_COMMUNICATION X WHERE A.SCC_LETTER_CD = C.SCC_LETTER_CD AND A.SCC_LETTER_CD = X.SCC_LETTER_CD AND B.INSTITUTION = C.INSTITUTION AND B.COMM_CONTEXT = C.COMM_CONTEXT AND B.COMM_CONTEXT = E.COMM_CONTEXT AND C.EFFDT = B.EFFDT AND B.EFFDT = ( SELECT MAX(Z.EFFDT) FROM PS_COMM_CTXT_TBL Z WHERE D.INSTITUTION = Z.INSTITUTION AND B.COMM_CONTEXT = Z.COMM_CONTEXT AND Z.EFFDT <= D.EFFDT) AND B.EFF_STATUS = 'A' AND B.INSTITUTION = D.INSTITUTION AND D.INSTITUTION = E.INSTITUTION AND D.EFFDT = E.EFFDT AND D.EFFDT = ( SELECT MAX(Y.EFFDT) FROM PS_COMM_CATG_TBL Y WHERE D.INSTITUTION = Y.INSTITUTION AND D.COMM_CATEGORY = Y.COMM_CATEGORY AND Y.EFFDT <= %CurrentDateIn) AND D.EFF_STATUS = 'A' AND D.COMM_CATEGORY = E.COMM_CATEGORY AND F.COMM_CATEGORY = D.COMM_CATEGORY AND F.INSTITUTION = B.INSTITUTION AND F.GROUP_3C = G.GROUP_3C AND B.INSTITUTION = G.INSTITUTION AND G.ENTRY_USE_IND = 'Y' AND X.COMM_METHOD IN ('B', 'D', 'L')
|