title: Creating a dynamic date range in SQL
body: <p>How can I construct a SQL statement that will always return a start date of July 1 of the previous year, and an end date of June 30 of the current year based on GETDATE()? Right now I have </p>
  
  <pre><code>    Dateadd(yy, Datediff(yy,1,GETDATE())-1,0) AS StartDate,
  DateAdd(dd,-1,Dateadd(yy, Datediff(yy,0,GETDATE()),0)) AS EndDate
  </code></pre>
  
  <p>which will return January 1, 2012 and December 31, 2013 respectively..</p>