title: Inserting data from another table
body: <p>I have two tables:</p>
  
  <p>Stock Data</p>
  
  <pre><code>Batch Stock Rate 
  ------------------------
  123---ABC---123 
  251---XYZ---50
  250---XYZ---55
  247---XYZ---48
  118---ABC---120
  310---PQR---77
  309---PQR---76
  </code></pre>
  
  <p>and the second table
  Order Book</p>
  
  <pre><code>Date-------Stock---qty--Rate
  --------------------------
  2016-01-01---ABC---10---Null
  2016-01-02---XYZ---25---Null
  2016-01-03---PQR---18---Null
  2016-01-04---XYZ---50---Null
  </code></pre>
  
  <p>I am stuck with inserting the Rate in the Order book table from Stock Data where the rate the in the stock data should be of the latest batch for each product. Thanks in advance</p>