title: mysql subquery inside a LEFT JOIN
body: <p>I have a query that needs the most recent record from a secondary table called <code>tbl_emails_sent</code>.</p>
  
  <p>That table holds all the emails sent to clients.  And most clients have several to hundreds of emails recorded.  I want to pull a query that displays the most recent.</p>
  
  <p>Example:</p>
  
  <pre><code>SELECT c.name, c.email, e.datesent
  FROM `tbl_customers` c
  LEFT JOIN `tbl_emails_sent` e ON c.customerid = e.customerid
  </code></pre>
  
  <p>I'm guessing a LEFT JOIN with a subquery would be used, but I don't delve into subqueries much.  Am I going the right direction? </p>
  
  <p>Currently the query above isn't optimized for specifying the most recent record in the table, so I need a little assistance.</p>