title: Nested Select statement in MYSQL join
body: <pre><code>SELECT * FROM A
  JOIN B
  ON B.ID = A.ID
  AND B.Time =   (SELECT max(Time) 
                              FROM B B2
                              WHERE B2.ID = B.ID)
  </code></pre>
  
  <p>I am trying to join these two tables in MYSQL. Don't pay attention to that if the ID is unique then I wouldn't be trying to do this. I condensed the real solution to paint a simplified picture. I am trying to grab and join the table B on the max date for a certain record. This procedure is getting run by an SSIS package and is saying B2.ID is an unknown column. I do things like this frequently in MSSQL and am new to MYSQL. Anyone have any pointers or ideas?</p>