title: sum of last month and total
body: <p>Im trying to get sum of points for a user in the last month and the total, is it possible to get it in one query? Im using zend but i can probably get it working with provided sql.</p>
  
  <p>heres my total for last month</p>
  
  <pre><code>$select = $this-&gt;_db
              -&gt;select()
              -&gt;from(array('p' =&gt; $this-&gt;_name), array(
                  'user_login',
                  'sum' =&gt; new Zend_Db_Expr('SUM(p.value)'),
                  )
              )
              -&gt;joinLeft(array('u' =&gt; 'user'), 'p.user_login = u.login')
              -&gt;group('p.user_login')
              -&gt;where('DATE(when) &gt;= CURDATE() - INTERVAL 30 DAY')
              -&gt;order('sum DESC')
              ;
      return $this-&gt;getAdapter()-&gt;fetchAll($select);
  </code></pre>