title: SQL - How to exclude Sunday from date range
body: <p>I have the following code </p>
  
  <pre><code>SELECT AccountNum, DateStart, DateEnd
  FROM TableA
  WHERE DateStart &gt; '2020-04-01'
  AND DateStart =&gt; DATEADD(day,-5, DateEnd)
  </code></pre>
  
  <p>The code currently grabs all the records where the DateEnd is within 5 days of DateStart. </p>
  
  <p>What I want to add is for it to exclude Sunday as one of the days it counts. So if Sunday happens to be one of the days between DateEnd and DateEnd - 5 then change that -5 to a -6.</p>