title: sql query to select credit cards about to expire
body: <p>I have credits card table that has <code>month</code> and <code>year</code> fields which store values like <code>02</code> and <code>2013</code>. I am new to sql and not sure where to start. How do I select only those records which expire few days before credit card are expired in order to send email to customers that their credit cards are about to expire.</p>
  <p>I have this so far:</p>
  <pre><code>SELECT * FROM credit_cards WHERE (what here?)
  </code></pre>
  <p>Alternatively, I can select all records from table and from php code check dates for cards that are about to expire eg 5 days before but again I am not sure what php code should be written for.</p>
  <p>Many thanks for the help</p>
  <hr />
  <h1>Update</h1>
  <p>I have come up with this query:</p>
  <pre><code>SELECT * from credit_cards WHERE (concat(year,'-', month, '-01') &lt; CURDATE())
  </code></pre>
  <p>Is that correct way to get it ? Although I am not receiving sql error.</p>