title: how to fetch data from past week in sql
body: <p>Currently My query is fetching data from current date to past 7 days .I want to fetch data from past week .Means If today is 2013-06-20 then data should be fetched from last week(2013-06-10 to 2013-06-16).I Searched many forum for exact answer but am still unable to find.</p>
  
  <p>Here is my query </p>
  
  <pre><code> SELECT CONVERT(varchar(25),PostDate,107) AS duration, count(*) AS posts
      FROM MDBDetails WHERE 
        DateAdd(dd, 0, DateDiff(dd, 0, PostDate)) &lt;= DateAdd(dd, 0, DateDiff(dd, 0, GETDATE())) AND 
        DateAdd(dd, 0, DateDiff(dd, 0, PostDate)) &gt;= DateAdd(dd, 0, DateDiff(dd, 0, GETDATE())) - 7
  
            GROUP BY  CONVERT(varchar(25),PostDate,107)
            ORDER BY duration
  </code></pre>