title: MySQL - Getting age and numbers of days between two dates
body: <p>I am trying to query a huge database (aprroximately 20 millions records) to get some data. This is the query I am working on right now.</p>
  
  <pre><code>SELECT a.user_id, b.last_name, b.first_name, c.birth_date FROM users a
  INNER JOIN users_signup b ON a.user_id a = b.user_id
  INNER JOIN users_personal c ON a.user_id a = c.user_id
  INNER JOIN
  (
  SELECT distinct d.a.user_id FROM users_signup d
  WHERE d.join_date &gt;= '2013-01-01' and d.join_date &lt; '2014-01-01'
  ) 
  AS t ON a.user_id = t.user_id
  </code></pre>
  
  <p>I have some problems trying to retrieve additional data from the database. I would like to add 2 additional field to the results table:</p>
  
  <ol>
  <li>I am able to get the birth date but I would like to get the age of the members in the results table. The data is stored as 'yyyy-mm-dd' in the users_personal table.</li>
  <li>I would like to get the total days since a member joined till the day the left (if any) from a table called user_signup using data from join_date &amp; left_date (format: yyyy-mm-dd). </li>
  </ol>