title: MySQL only within the current month?
body: <p>I have the following MySQL query, and I'm trying to adjust it so it only fetches results which are within the current month (of the current year), I'm guessing you may require more info about my MySQL structure so here it goes - I have a UNIX timestamp generated by PHP's <code>time()</code> stored within the <code>time</code> column (under the <code>referrals</code> table), so with the below setup it would be <code>t2.time</code>.</p>
  
  <p>So my problem is I'm unsure how to proceed, I'm guessing it would be something like adding the following to end of the <code>WHERE</code> clause? => <code>AND t2.time IS WITHIN THE CURRENT MONTH</code> <em>(caps are just on to distinguish problem from rest of query)</em> but i'm not sure how to check if its within the current month.</p>
  
  <p><strong>The MySQL Query:</strong></p>
  
  <pre><code>SELECT t1.username,
         t1.website,
         SUM(IF(t2.type = 'in', 1, 0))  AS in_count,
         SUM(IF(t2.type = 'out', 1, 0)) AS out_count
  FROM   users AS t1
         JOIN referrals AS t2
           ON t1.username = t2.author
  WHERE  t1.website != ''
  GROUP  BY t1.username,
            t1.website
  ORDER  BY in_count DESC 
  LIMIT  0, 10 
  </code></pre>
  
  <p>Appreciate all help! :B</p>