title: How to fetch last entered entry for a id from table MYSQL
body: <p>I have 3 tables:</p>
  
  <p>A order goes through multiple states. so each state have entry in  table_orderstatus. Statusdate will be there, but not shown in this example.</p>
  
  <p>Example</p>
  
  <p>table_orders - orderid, ordervalue;</p>
  
  <pre><code>1- 500
  2- 1000
  3- 8000
  4- 10000
  </code></pre>
  
  <p>table_orderstatus - orderid, statusid, statusdate; (orderid, statusid)</p>
  
  <pre><code>1- 1 
  1- 2
  2- 1
  2- 3
  3- 1 
  3- 3
  3- 4
  4- 1
  4- 3
  4- 4
  4- 5
  5- 1
  </code></pre>
  
  <p>table_statusvalues - statusid, statusvalue;</p>
  
  <pre><code>1- NEW
  2- CANCEL
  3- CONFIRM
  4- DISPATCHED
  5- DELIVERED
  </code></pre>
  
  <p>I want to fetch order_id, and last status value (not id) for all the orders.</p>
  
  <pre><code>1- CANCEL
  2- CONFIRM
  3- DISPATCHED 
  4- DELIVERED
  5- NEW
  </code></pre>
  
  <p>I tried multiple ways to achieve same. But coudn't got expected result. Can anyone help me on this? </p>