title: Get value with MAX(date) from two table
body: <p>I have two tables.</p>
  
  <pre><code>MainTable:
  MainID | LastValue | LastReadingDate
  1      | 234       | 01.01.2012
  2      | 534       | 03.02.2012
  
  Readings:
  MainID | ValueRead | ReadingDate
  1      | 123       | 03.02.2012
  1      | 488       | 04.03.2012
  2      | 324       | 03.02.2012
  2      | 683       | 05.04.2012
  </code></pre>
  
  <p>I want to get </p>
  
  <pre><code>SELECT MainTable.MainID, MainTable.LastValue, MainTable.LastReadingDate, (SELECT ValueRead, MAX(ReadingDate) 
  FROM Readings 
  WHERE Readings.MainID=MainTable.MainID ORDER BY ValueRead)
  </code></pre>
  
  <p>In other words, I want to get the current LastValue and LastReadingDate from MainTable along side the ValueRead with the most recent ReadingDate from Readings.</p>