The following example uses an ELSE clause. SELECT * FROM t WHERE x = CASE WHEN y=2 THEN 1 ELSE 2 END;