title: Rewriting MySQL date functions for SQLite
body: <p>Please help me rewrite this query from MySQL to SQLite format:</p>
  
  <pre class="lang-sql prettyprint-override"><code>SELECT MAX(pubdate) as pubdate, 
  COUNT(DISTINCT post_id) AS count, 
  DATE_FORMAT(pubdate,"%b-%y") as month 
  FROM posts 
  WHERE pubdate &gt;= DATE_SUB(CURDATE(), INTERVAL 5 MONTH) 
  GROUP BY month 
  ORDER BY pubdate ASC
  </code></pre>
  
  <p>Basically, I want to get the count of all posts for the last 5 months grouped by the month, but I have difficulties rewriting <code>DATE_FORMAT(...)</code> and <code>DATE_SUB(...)</code> functions.</p>
  
  <p><code>pubdate</code> has the standard MySQL <code>TIMESTAMP</code> format (<code>2011-06-21 20:05:01</code>)</p>