title: Find records between two Quarters in SQL Server?
body: <p>I want to find records between two-quarters of different years in SQL Server.</p>
  
  <pre><code>SELECT    ('Q'+cast(DATEPART(QUARTER,calldate) as varchar(3))+'-'+cast(YEAR(calldate) as varchar(4)))
  period,providerid,volume as volume,type  
  FROM  table V    
  where DATEPART(QUARTER,calldate) between @Q1 and @Q2 and                             
  datepart(year,calldate) in (@Y1,@Y2)  and providerid=@carrierID  
  </code></pre>
  
  <p>Here Q1=4 and Q2=3 and @Y1=2014,@Y2=2016</p>
  
  <pre><code> Now,I have only records from Q2-2016, So it should return available records      
   but I am getting blank rows.
   if I change the parameter like this 
   Here Q1=3 and Q2=4 and @Y1=2014,@Y2=2016 then i am getting records.
  </code></pre>
  
  <p>I want all records between these two-quarters like (Q3-2014 and Q2-2016).?</p>