title: Getting max value of related table data in PostgreSQL
body: <p>I am trying to get next:</p>
  <p>I have a table orders. This table has column order_uuid.
  I have another table status_history which has all the statuses of each order.</p>
  <p>I need to get all the order and the max value of all the statuses of each order.</p>
  <p>Example:</p>
  <p>order1 has statuses 1,2,3<br />
  order2 has statuses 4,5,6</p>
  <p>it must return order1, 3      and order2 and 6.</p>