SELECT DISTINCT A.HRS_REPORT_DEFN_ID , A.HRS_REPORT_TMPL_ID FROM PS_HRS_INT_LTR A WHERE A.HRS_LTR_PRINT_DT IS NULL AND A.HRS_REPORT_DEFN_ID <> ' ' AND A.HRS_REPORT_TMPL_ID <> ' ' AND A.HRS_INT_LTR_ID = ( SELECT MAX(B.HRS_INT_LTR_ID) FROM PS_HRS_INT_LTR B WHERE B.HRS_PERSON_ID = A.HRS_PERSON_ID AND B.HRS_RCMNT_ID = A.HRS_RCMNT_ID AND B.HRS_RCM_INT_ID = A.HRS_RCM_INT_ID) AND EXISTS ( SELECT 'X' FROM PSXPRPTTMPL_VW C WHERE C.REPORT_DEFN_ID = A.HRS_REPORT_DEFN_ID AND C.TMPLDEFN_ID = A.HRS_REPORT_TMPL_ID)
|