I have an complex situation. I want to write an sql query including "case when" condition on "where clause".
Just like that:
SELECT *
FROM <table>
WHERE
<Column1> in
CASE <Column2>
WHEN 1 THEN ('OP', 'CL')
WHEN 0 THEN ('RE', 'ST')
END
Column1 must be "in", not "=". Because there is multiple value at condition for Column1. That query returns "Incorrect syntax near ','." error.
Can you give me any suggestion? (Sorry for my bad English.)
EDIT : I think I misunderstood. If Column2 is 1, condition must like that "IN ('OP', 'CL')" else Column1 is 2, condition must like that "IN ('RE', 'ST')".