title: MySQL: Join table fields to related result set
body: <p>I have two tables.</p>
  
  <p>The 'parameters' table (below) keeps track of parameters attached to various components:</p>
  
  <pre><code>id (pk) | name | component
  </code></pre>
  
  <p>The 'parameterLog' table tracks the values of a parameter across time:</p>
  
  <pre><code>action_date | parameter (fk) | value | notes
  </code></pre>
  
  <p>I have the following result set:</p>
  
  <pre><code>SELECT * FROM parameters WHERE component = 1;
  +----+------+-----------+
  | id | name | component |
  +----+------+-----------+
  |  1 | par1 |         1 |
  |  2 | par2 |         1 |
  +----+------+-----------+
  </code></pre>
  
  <p>For each entry in the above result set, I need the corresponding and most recent action_date, value, and note from the 'parameterLog' table.</p>
  
  <p>[Edit]
  For clarity, I'm including the tables with data below.</p>
  
  <pre><code>parameters:
  +----+------+-----------+
  | id | name | component |
  +----+------+-----------+
  |  1 | par1 |         1 |
  |  2 | par2 |         1 |
  |  3 | par1 |         2 |
  |  4 | par2 |         2 |
  |  5 | par1 |         3 |
  |  6 | par2 |         3 |
  |  7 | par3 |         3 |
  |  8 | par1 |         4 |
  |  9 | par2 |         4 |
  | 10 | par1 |         6 |
  | 11 | par2 |         6 |
  +----+------+-----------+
  
  parameterLog:
  +-------------+-----------+-------+-------+
  | action_date | parameter | value | notes |
  +-------------+-----------+-------+-------+
  | 2010-01-01  |         1 | 0     | NULL  |
  | 2010-02-03  |         1 | 4     | NULL  |
  | 2010-01-01  |         2 | 0     | NULL  |
  | 2010-01-01  |         3 | 1     | NULL  |
  | 2010-01-01  |         4 | 1     | NULL  |
  | 2010-01-14  |         5 | 0     | NULL  |
  | 2010-01-14  |         6 | 1     | NULL  |
  | 2010-01-14  |         7 | 2     | NULL  |
  | 2010-01-14  |         8 | 3     | NULL  |
  | 2010-02-03  |         8 | 1     | NULL  |
  | 2010-01-14  |         9 | 4     | NULL  |
  | 2010-02-03  |         9 | 1     | NULL  |
  | 2010-02-25  |        10 | 9     | NULL  |
  | 2010-02-25  |        11 | 9     | NULL  |
  +-------------+-----------+-------+-------+
  </code></pre>