SELECT DISTINCT A.COMPANY , B.PLAN_TYPE , B.DEDCD , B.DESCR FROM PS_PY_MOD_COMPNY X , PS_GDED_COM_DEF A , PS_DEDUCTION_TBL B , PS_DEDUCTION_CLASS C WHERE A.COMPANY = X.COMPANY AND A.EFFDT = ( SELECT MAX(A_ED.EFFDT) FROM PS_GDED_COM_DEF A_ED WHERE A.COMPANY = A_ED.COMPANY AND A.DEDCD = A_ED.DEDCD AND A_ED.EFFDT <= %CurrentDateIn) AND A.DEDCD=B.DEDCD AND B.PLAN_TYPE = '00' AND B.SPCL_PROCESS <> 'G' AND B.EFFDT = ( SELECT MAX(EFFDT) FROM PS_DEDUCTION_TBL WHERE PLAN_TYPE = B.PLAN_TYPE AND DEDCD = B.DEDCD AND EFFDT <= A.EFFDT) AND B.PLAN_TYPE = C.PLAN_TYPE AND B.DEDCD = C.DEDCD AND C.DED_CLASS IN ('A','B') AND C.EFFDT = ( SELECT MAX(C_ED.EFFDT) FROM PS_DEDUCTION_CLASS C_ED WHERE C.PLAN_TYPE = C_ED.PLAN_TYPE AND C.DEDCD = C_ED.DEDCD AND C_ED.EFFDT <= B.EFFDT)
|