title: T-SQL - Combine IN Clause and CASE statement
body: <p>I need to do something like this:<br></p>
  
  <pre><code>select *
  from  Table 
        inner join Few more tables
  where t2.ID IN( case when @Param1 = 0 then 
                          (select ID FROM tbl10 WHERE ForeignKey = @param2) 
                  else @Param1 end)
  </code></pre>
  
  <p>So if @Param1 is 0 then i want some set of values to be a match(based on the @param2),and if its not 0 i want just @Param1 to match.
  i have tried few syntax variations but it wont work.</p>
  
  <p>I have also seen a similar question,but it didn't help me.</p>