SELECT DISTINCT B.Plan_Type , B.Benefit_Plan , B.Dedcd , C.Descr FROM PS_BEN_DEFN_PGM A , PS_Ben_Defn_Optn B , PS_Deduction_Tbl C , PS_Deduction_Class D WHERE A.Eff_Status = 'A' AND A.EffDt = ( SELECT MAX(A_ED.EFFDT) FROM PS_BEN_DEFN_PGM A_ED WHERE A.BENEFIT_PROGRAM = A_ED.BENEFIT_PROGRAM AND A_ED.EFFDT <= %CurrentDateIn) AND A.Benefit_Program = B.Benefit_Program AND A.Effdt = B.Effdt AND C.Plan_Type = B.Plan_Type AND C.Dedcd = B.Dedcd AND C.EffDt = ( SELECT MAX(C_ED.EffDt) FROM PS_Deduction_Tbl C_ED WHERE C_ED.Plan_Type = C.Plan_Type AND C_ED.Dedcd = C.Dedcd AND C_ED.EffDt <= A.EffDt) AND D.PLAN_TYPE = C.PLAN_TYPE AND D.DEDCD = C.DEDCD AND D.DED_CLASS IN ('A','B') AND D.EFFDT = ( SELECT MAX(D_ED.EFFDT) FROM PS_DEDUCTION_CLASS D_ED WHERE D.PLAN_TYPE = D_ED.PLAN_TYPE AND D.DEDCD = D_ED.DEDCD AND D_ED.EFFDT <= C.EFFDT)
|