title: How to use Date range in the WHERE clause
body: <p>I want to modify my <code>Where</code> clause in my <code>SQL Server Query</code> below so that it would select ALL records from the previous month.</p>
  
  <p>Example: if I run the query on 20 Feb, it should extract data for 1 Jan to 31 Jan</p>
  
  <p>I have tried using the following but as you may notice, it picks up the records a month back from the day of execution.</p>
  
  <pre><code>WHERE date_col &gt;= cast(dateadd(Month, -1, getdate()) as date) and
        date_col &lt;= cast(getdate() as date)
  </code></pre>