title: mysql join question, joining newest record in a one to many relationship
body: <p>I have a simple (hopefully) SQL question for you, any help would be much, much appreciated :).</p>
  
  <p>I have two tables which I would like to join.</p>
  
  <p>One Is Users, lets say it's called users</p>
  
  <p>One is a kind of history of that user, lets say its called users_history.</p>
  
  <p>The relationship of these two is a one <strong>users</strong> to many <strong>users_history</strong> relationship.</p>
  
  <p>What I'd like to do is a query which joins the tables and joins the newest record in users_history onto each user.</p>
  
  <p>Lets say the tables are like this, I'm simplifying for conciseness.</p>
  
  <p><strong>users</strong></p>
  
  <ul>
  <li>id</li>
  <li>name</li>
  </ul>
  
  <p><strong>users_history</strong></p>
  
  <ul>
  <li>id</li>
  <li>user_id</li>
  <li>date</li>
  </ul>
  
  <p>The date is formatted YYYYMMDD.</p>
  
  <p>The end result is I'd like to be able to pull out all of the users who don't have a users_history record for today, for example today is 20101021.</p>
  
  <p>Any help would be very gratefully received! :)</p>