title: Transfer data from one table to another if data doesn't exist
body: <p>I have 2 Tables in MySQL and they are:</p>
  
  <p><a href="https://i.stack.imgur.com/2CzAM.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2CzAM.jpg" alt="enter image description here"></a></p>
  
  <p>As what you see on the Image above the The First 4 Rows of the Field <code>Item Code</code> of the Tables <code>General Inventory</code> and <code>Purchase Order</code> are the Same and the 5th row in the table <code>Purchase Order</code> are not in the table <code>General Inventory</code>. Now my Question is how can I achieve this? (Image Below)</p>
  
  <p><a href="https://i.stack.imgur.com/zTVQN.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zTVQN.jpg" alt="enter image description here"></a></p>
  
  <p>as what you see on the Image above the Data from the field <code>Quantity</code> of Tables <code>General Inventory</code> and <code>Purchase Order</code> has been SUM because there preceding data under field <code>Item Code</code> is same and the Last one that has no equal value in the <code>General Inventory</code> table has been added.</p>
  
  <p><strong>Let me Shorten Up the Question.</strong></p>
  
  <p>How can I Sum Up the Data from the field <code>Quantity</code> of <code>Purchase Order</code> in the <code>General Quantity</code> if there Data in the <code>Item Code</code> field are the same else add the new data if the Data from <code>Purchase Order</code> doesn't exist in <code>General Inventory</code>.</p>
  
  <p>I tried this code.</p>
  
  <pre><code>UPDATE GeneralInventory GI
  INNER JOIN PurchaseOrder PO ON GI.ItemCode = PO.ItemCode AND GI.`Description` = PO.`Description` AND GI.Quantity = PO.Quantity  
  SET GI.Quantity = GI.Quantity + PO.Quantity
  </code></pre>
  
  <p>and the Output is this</p>
  
  <p><a href="https://i.stack.imgur.com/LZ8W3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LZ8W3.png" alt="enter image description here"></a></p>
  
  <p>Now I tried the Second Code</p>
  
  <pre><code>INSERT INTO GeneralInventory (ItemCode, `Description`, Quantity)
  SELECT PO.ItemCode, PO.`Description`, PO.Quantity
  FROM PurchaseOrder PO
  LEFT JOIN GeneralInventory GI ON GI.ItemCode = PO.ItemCode AND GI.`Description` = PO.`Description` AND GI.Quantity = PO.Quantity
  WHERE GI.ItemCode IS NULL
  </code></pre>
  
  <p>the output is this.</p>
  
  <p><a href="https://i.stack.imgur.com/IhztI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IhztI.png" alt="enter image description here"></a></p>
  
  <p>The data has been Repeated instead the the <code>Item 5</code> will be added.</p>