title: Multiple Dates Ranges in Sql Select Query
body: <p>I am currently working on C# with Sql Server Language, trying to design a query where I have to select quarters(Q1, Q2, Q3, Q4).</p>
  
  <p>My issue is that, suppose if the user from the front end selects only Q1 then I can set the query to date range for quarter Q1, and if the user selects Q1 and as well Q2 then I can still set the date range for Q1 and Q2 because they fall under sequence date ranges.</p>
  
  <p>But if the user selects Q1 and Q3 then how do I prepare date range query(either in stored procedure or simple select query) and excecute for this. </p>
  
  <p>I was trying with this but no use.</p>
  
  <pre><code>where CDate in(cdate between '2015-05-20' and '2015-06-01' 
    and CDate between '2016-06-03' and '2016-06-04'
  
  select * from MM  where @innerstring
  </code></pre>
  
  <p>The @innerstring I want to send as a parameter to the sql stored procedure and then prepare/execute it.
  but I don't want to use temp table to store query data for saperate date ranges and then union that result. because I have different parameters with me as well.</p>
  
  <p>Thanks.</p>