title: sql query to show records created today, last week and last month
body: <p>I want to write some sql queries to show me records from mysql database that are created today, records created last week, and records created last month..The first query show me results created in last 7 days (including today). For example if today is Sunday, I want to see results created from Monday to Saturday (not today). Similarly, in the second query I want to see records created last month (excluding records of this month). For example, if this is June, I want to see records created in May</p>
  
  <pre><code>SELECT COUNT(*) AS stdtotal FROM `login` 
  WHERE `account_created_date`  &gt; DATE_SUB(NOW(), INTERVAL 7 DAY)
  </code></pre>
  
  <p>and the other query is </p>
  
  <pre><code>SELECT COUNT(*) AS stdtotal FROM `login` 
  WHERE `account_created_date`  &gt; DATE_SUB(NOW(), INTERVAL 30 DAY)
  </code></pre>
  
  <p>Note that my table name is <code>login</code> and the column name is <code>account_created_date</code> of type date.</p>