title: SQL value from the database between 11th of last month to the 10th of this month
body: <p>Hi All I'm trying to get the sum the values from a SQL database from the 11th of last month to the 10th of this month ie.</p>
  
  <pre><code>SELECT SUM(pay) AS month_pay 
  FROM payaccounts 
  WHERE dates BETWEEN 11th of last month and the 10th of this month
  </code></pre>
  
  <p>I am at currently using this statement to find the values from last month but now i've been told we need to change this to the 11th.</p>
  
  <pre><code>SELECT SUM(pay) AS month_pay 
  FROM payaccounts 
  WHERE (DATEPART(m, date) = DATEPART(m, DATEADD(m, - 1, GETDATE()))) AND 
        (DATEPART(yy, date) = DATEPART(yy, DATEADD(m, - 1, GETDATE())))
  </code></pre>