title: mysql case when in clauses
body: <p>I have to check the value of @inv_status with below MySQL code but not getting the desired output.
  I am expecting "success 1" but it is giving 0, please suggest.</p>
  
  <pre><code>SET @ip_AllocationId = 1;
  SET @ip_status = NULL;
  
  SET @inv_status = 4;
  
  
  SELECT  CASE WHEN @inv_status IN(
  SELECT
  CASE 
    WHEN @ip_AllocationId = 1 AND ISNULL(@ip_status) THEN (SELECT CONCAT("1",",","4"))
    WHEN @ip_AllocationId = 1 AND @ip_status=1 THEN 1
    WHEN @ip_AllocationId = 1 AND @ip_status=2 THEN 4
    ELSE NULL
   END AS filter
  ) THEN "1" ELSE "0" END AS "success"; 
  </code></pre>