title: Get MAX value from two tables
body: <p>Using <a href="/questions/tagged/postgresql" class="post-tag" title="show questions tagged &#39;postgresql&#39;" rel="tag">postgresql</a> and I have two tables (users &amp; live_user_data) with a unique ID to join between the two, both tables have the user ID, but one has a user level (null and 1 to 50).</p>
  
  <p>live_user_data contains every instance a user's level was recorded, so it contains hundreds of thousands of instances, so when do a simple join query, I get every level result for every user. What I'd like is to get results that shows just a list of all users with the max value for their user_level.</p>
  
  <p>table: users</p>
  
  <pre><code>id  system_id user_id
  1 001 John Smith
  2 002 Jacob Smith
  3 001 John Smith
  4 003 Steve Smith
  5 002 Jacob Smith
  </code></pre>
  
  <p>table: live_user_data</p>
  
  <pre><code>system_id level
  002 1
  002 7
  001 10
  003 4
  002 15
  </code></pre>