title: Automating Query for each month
body: <p>I have a query below:</p>
  
  <pre><code>select a.ID, 
         a.Date_Reported, 
         b.Date_Received
  from tx_ext a 
  join tx b on b.id = a.id
  AND b.Date_Reported &gt;= convert( datetime, '2018-05-01' ) 
  AND b.Date_Reported &lt;= convert( datetime, '2018-05-31' )
  </code></pre>
  
  <p>As you can see, I am currently manually setting the date for May (last month). How can I alter my query, that whatever month I am in, I always run the full previous month. So for example this month is June, so I would like to run values from may alone. And next month is July, so I would like to run june.</p>
  
  <p>I want to automate this, so i don't need to manually enter dates every month</p>
  
  <p>thanks</p>