title: SQL - Subtract values in 2 columns - Add to new column
body: <p><strong>* EDIT *</strong> </p>
  
  <p>Got the original code working now thanks to some help from some great users on here!</p>
  
  <pre><code> SELECT 
                 STOCK.STOCK_CODE As Stock_Code,
                 STOCK.SHORT_DESC As Stock_Description,
                 STOCK.AVAILABILITY As Available, 
                 SUM(SORDER_ITEM.QTY_SOLD) As Quantity_Sold,
                 ABS(CAST(STOCK.AVAILABILITY AS INT) - CAST(SORDER_ITEM.QTY_SOLD AS INT)) AS ACTUAL
  FROM 
      STOCK INNER JOIN SORDER_ITEM ON STOCK.STOCK_ID=SORDER_ITEM.STOCK_ID
  GROUP BY SORDER_ITEM.QTY_SOLD, STOCK.STOCK_CODE, STOCK.SHORT_DESC, STOCK.AVAILABILITY
  </code></pre>
  
  <p>I've done a GROUP BY but the data still comes out as such: </p>
  
  <pre><code>5000A   TShirt  107 28  93
  5000A   TShirt  107 21  86
  5000A   TShirt  107 14  100
  </code></pre>
  
  <p>However it should read:</p>
  
  <pre><code>5000A TShirt - 107 63 44
  </code></pre>
  
  <p>SAMPLE DATA *
  SQL RETURNS:</p>
  
  <pre><code>5000A   Tshirt  107 28  93
  5000A   Tshirt  107 21  86
  5000A   Tshirt  107 14  100
  </code></pre>
  
  <p>STOCK</p>
  
  <pre><code>5000A - TSHIRT - 107
  </code></pre>
  
  <p>SORDER_ITEM</p>
  
  <pre><code>5000A - TSHIRT - 28
  5000A - TSHIRT - 21
  5000A - TSHIRT - 14
  </code></pre>