I have select:
select col1,
case
when col2 = 'AB' then col3
else cols2
end as colX,
col4,sum(col5) from table 1
where....
group by col1,
case
when col2 = 'AB' then col3
else cols2
end, col4
How to the where add something like: col2 not in ('AA','BB')?
I can't add col2 to my select, because I have couple of joins in my whole select statement.