SELECT %Sql(SCRTY_SEL_PKEY,SEC,SEC) ,A.SETID ,A.FP_COMM_ACNT_ID ,A.FP_CA_CATG_ID ,A.FP_APPL_DT ,SEC.NAME FROM PS_FPA_CA_TBL A , PS_FPA_CA_STATUS S %Sql(SCRTY_FPS_FROM,C) , PS_EMPLMT_SRCH_GBL SEC WHERE SEC.EMPLID = A.EMPLID AND SEC.EMPL_RCD = A.EMPL_RCD AND A.FP_CA_STATUS <> 'X' AND A.FP_CA_STATUS <> 'D' AND A.EMPLID = S.EMPLID AND A.EMPL_RCD = S.EMPL_RCD AND S.FP_CA_C_FLAG = ' ' AND S.FP_CA_D_FLAG = ' ' AND S.FP_CA_M_FLAG = ' ' AND S.FP_CA_X_FLAG = ' ' AND S.FP_CA_W_FLAG = ' ' AND A.FP_APPL_DT = ( SELECT MAX(E.FP_APPL_DT) FROM PS_FPA_CA_TBL E WHERE E.EMPLID = A.EMPLID AND E.EMPL_RCD = A.EMPL_RCD AND E.FP_CA_STATUS <> 'X' AND E.FP_CA_STATUS <> 'D' ) AND (A.FP_END_DT IS NULL OR A.FP_END_DT = ( SELECT MAX(F.FP_END_DT) FROM PS_FPA_CA_TBL F WHERE F.EMPLID = A.EMPLID AND F.EMPL_RCD = A.EMPL_RCD AND F.FP_CA_STATUS <> 'X' AND F.FP_CA_STATUS <> 'D' )) AND A.EMPLID=C.EMPLID AND A.EMPL_RCD = C.EMPL_RCD %Sql(SCRTY_FPS_WHERE,C)
|