title: How to write a query that selects last specific day and goes back 1 week from there?
body: <p>I use <a href="https://data.stackexchange.com/stackoverflow/query/201514/find-answers-to-flag" rel="nofollow noreferrer">this query</a> on SEDE. I have just been editing the <code>WHERE p.CreationDate &gt; '2014-12-21T00:00:00.001'</code> like every week to select the last week's records only. So for example previous edits were just changing to 12-21 from 12-14 from 12-7, etc..</p>
  <p>I'm trying to edit that part so that I don't have to keep editing it every week.</p>
  <p>I was thinking I could do something like</p>
  <pre><code>WHERE DATEDIFF(DAY, p.creationDate, GETDATE()) &lt;= 7
  </code></pre>
  <p>which would select only results from the last 7 days.</p>
  <p>However, this will only work on like Sunday when SEDE is updated. If I run a query on Wednesday, then this query will be missing three days of results.</p>
  <p>How could I write this <code>where</code> statement to like find the last nearest Sunday, or is Sunday, and then go back one week from there?</p>