CASE IN statement with multiple values

sql, sql-server, sql-server-2005

Solution

Yes. You need to use the "Searched" form rather than the "Simple" form of the `CASE` expression

SELECT CASE
         WHEN c.Number IN ( '1121231', '31242323' ) THEN 1
         WHEN c.Number IN ( '234523', '2342423' ) THEN 2
       END AS Test
FROM   tblClient c  

Problem

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 ```

Original source