title: Struggling with a simple SQL JOIN
body: <p>I'm pretty bad at SQL and have been having some troubles doing somewhat of a UNIQUE join of two tables. The SQL structure is somewhat abysmal, but I didn't design it.</p>
  
  <p>I have two tables:</p>
  
  <p><strong>users</strong></p>
  
  <p>uid, ufn, uln, ue</p>
  
  <p><em>Where users id = uid.</em></p>
  
  <p>and</p>
  
  <p><strong>transactions</strong></p>
  
  <p>uid, unit, address, start_date</p>
  
  <p>Basically in the transactions table, there are multiple entries per uid. What I am looking to do is select <code>users.ufn, users.uln, users.ue, transactions.unit, transactions.address</code> based on <strong>ONLY</strong> the newest start_date. Meaning I will only get <strong>ONE</strong> result per uid. Currently I'm getting returns for <strong>ALL</strong> uid entries in the <code>transactions</code> table.</p>
  
  <p>I've tried doing some JOINS, LEFT JOINS, and things with MAX, but have been largely unsuccessful. </p>
  
  <p><code>SELECT * FROM users JOIN ( SELECT unit, address, start_date FROM transactions GROUP BY uid) as a ON users.tenant_id = a.tenant_id</code></p>
  
  <p>Is what I tried among a mix of other things. </p>
  
  <p>Any hint as to the right direction would be much appreciated. Thank you!</p>