Is there a way to make a CASE statement with an IN clause?
SELECT CASE c.Number IN ('1121231','31242323') THEN 1 IN ('234523','2342423') THEN 2 END AS Test FROM tblClient c
Yes. You need to use the "Searched" form rather than the "Simple" form of the CASE expression
CASE
SELECT CASE WHEN c.Number IN ( '1121231', '31242323' ) THEN 1 WHEN c.Number IN ( '234523', '2342423' ) THEN 2 END AS Test FROM tblClient c
1.4m articles
1.4m replys
5 comments
57.0k users