Case statement within and

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

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


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 !=0)) or
((a.ctm != 2) and b.cbt !=0)))