HiI have select Case WHEN RTC.liability IN ('L','EL','LVL') then '1' Else '' End As Rep_Liable From accinv_rec As RTC
and select case when RTC.age >= 18 and RTC.age <20 then '<20' when RTC.age >= 20 and RTC.age <25 then '<25' when RTC.age >= 25 and RTC.age <30 then '<30' when RTC.age >= 30 and RTC.age <35 then '<35' when RTC.age >= 35 and RTC.age <40 then '<40' when RTC.age >= 40 and RTC.age <45 then '<45' when RTC.age >= 45 and RTC.age <50 then '<50' when RTC.age >= 50 and RTC.age <55 then '<55' when RTC.age >= 55 and RTC.age <60 then '<60' when RTC.age >= 60 and RTC.age <65 then '<65' when RTC.age >= 65 and RTC.age <70 then '<70' when RTC.age >= 70 then '70+' else '' end as L_Age_Group from accinv_rec As RTC
and I can't get a handle on embedding the latter into the former i.e. WHEN RTC.liability IN ('L','EL','LVL')is met thenwhen RTC.age >= 65 and RTC.age <70 then '<70'etc I've tried what seems like dozens of variations and i get CASE warnings or WHEN . I guess i'm wrapping it wrongly but can't figure a way to build and test this taht exposes my error.If there is a way of reducing the second down, I'd be much obliged for that alsoMole