title: SQL Statement Help - Select latest Order for each Customer
body: <p>Say I have 2 tables: Customers and Orders. A Customer can have many Orders.</p>
  
  <p>Now, I need to show any Customers with his latest Order. This means if a Customer has more than one Orders, show only the Order with the latest Entry Time.</p>
  
  <p>This is how far I managed on my own:</p>
  
  <pre><code>SELECT a.*, b.Id
  FROM Customer a INNER JOIN Order b ON b.CustomerID = a.Id
  ORDER BY b.EntryTime DESC
  </code></pre>
  
  <p>This of course returns all Customers with one or more Orders, showing the latest Order first for each Customer, which is not what I wanted. My mind was stuck in a rut at this point, so I hope someone can point me in the right direction.</p>
  
  <p>For some reason, I <i>think</i> I need to use the MAX syntax somewhere, but it just escapes me right now.</p>
  
  <p><b>UPDATE:</b> After going through a few answers here (there's a lot!), I realized I made a mistake: I meant <b>any</b> Customer with his latest record. That means if he does not have an Order, then I do not need to list him. </p>
  
  <p><b>UPDATE2:</b> Fixed my own SQL statement, which probably caused no end of confusion to others.</p>