title: eloquent query for getting difference of two columns from different table
body: <p>I've to show the remaining quantity of books using eloquent query.
  I can get total number of purchased books from this table</p>
  
  <pre><code>ordered_books
  BOOKCODE[varchar(10)]   QUNATITY[varchar(6)]
  111                         25
  423                         15
  201                         10
  111                         10
  423                         10
  201                         5
  158                         12
  </code></pre>
  
  <p>At first I've to sum the total books for each of the book code. Then from the another table I've to calculate the difference.</p>
  
  <pre><code>books_out
  DISTRIBUTOR[varchar(50)]    BOOKCODE[varchar(10)]           QUNATITY[varchar(6)]    
  25                              158                             2
  35                              201                             5
  45                              158                             5
  55                              111                             10
  35                              111                             5
  15                              423                             1
  25                              423                             10
  </code></pre>
  
  <p>Again, from this table I've to calculate the total number of books taken by distributors then I can get the actual number of books present. How shall I write eloquent query for this scenario?</p>