 <p>You can use subqueries to get what you want, for example:</p> <pre><code>SELECT * FROM (SELECT INs.catid AS CategoryID, INs.subcatid AS SubcategoryID, SUM(INs.quantity) AS QuantityIN FROM in_stock INs GROUP BY INs.catid, INs.subcatid) AS a LEFT JOIN (SELECT OUTs.catid AS CategoryID, OUTs.subcatid AS SubcategoryID, SUM(OUTs.quantity) AS QuantityOUT FROM out_stock OUTs GROUP BY OUTs.catid, OUTs.subcatid) AS b ON ( a.subcategoryid = b.subcategoryid ) AND ( a.categoryid = b.categoryid ); </code></pre> <p>From this, it is very easy indeed to edit and modify the query using the Query Design Window in MS Access</p> <pre><code>SELECT a.categoryid, a.subcategoryid, a.quantityin, b.quantityout, [quantityin] - [quantityout] AS RemainingQuantity FROM (SELECT INs.catid AS CategoryID, INs.subcatid AS SubcategoryID, SUM(INs.quantity) AS QuantityIN FROM in_stock INs GROUP BY INs.catid, INs.subcatid) AS a LEFT JOIN (SELECT OUTs.catid AS CategoryID, OUTs.subcatid AS SubcategoryID, SUM(OUTs.quantity) AS QuantityOUT FROM out_stock OUTs GROUP BY OUTs.catid, OUTs.subcatid) AS b ON ( a.subcategoryid = b.subcategoryid ) AND ( a.categoryid = b.categoryid ); </code></pre>