title: Calculate the each product(Inkcode) stock
body: <p><img src="https://i.stack.imgur.com/7Pogf.png" alt="2 tables"> I have 2 tables Tblinkreceiving and Tblinkdelivery. I want to display the Stock balance for each inkcode.I tried the below sql join query but the calculation is wrong for many inkcodes when i cross check in manual calculation.Where it went wrong ?</p>
  
  <pre><code>select r.inkcode, SUM(r.quantity) Stock-In, SUM(d.quantity) Stock-out, (SUM(r.quantity) - SUM(d.quantity)) Stock-Balance from Tblinkreceiving r,Tblinkdelivery d where r.inkcode=d.inkcode
  group by r.inkcode;
  </code></pre>