Do you mean this?select date, sum(case when Model <> '' and Term= '2' and Code IN ('AB101','BC199', 'HJ234') and Ltype = 'P' and Changes = 'Y' then 1 when Model <> '' and Model not like '%MOTO%' and Term= '2' and Code IN ('HB128') and Ltype = 'P' and Changes = 'Y' then 1 else 0 end) as [Outside_model],from historywhere date between '20100201' and '20100428'and state in ('NY', 'NJ')group by date
No, you're never too old to Yak'n'Roll if you're too young to die.