Case statement within and

Hi, not sure what I have wrong but I got error from the syntax below.

select ...
where...
and
case a.ctm
when 2 then b.cat !=0 else b.cbt !=0

Thanks

CASE must return a single value; thus, it cannot include conditions or keywords.

I think you want your where clause to end with
… and (((a.ctm = 2) and b.cat !=0)) or
((a.ctm != 2) and b.cbt !=0)))