I tried this command but sadly it's not working correctly:
SELECT Category,SUM(Qty) AS RegQty,
(SELECT SUM(Qty)
FROM SalesDetail
WHERE LEFT(Barcode,1) IN('A','B')) AS SaleQty
FROM SalesDetail
WHERE LEFT(Barcode,1) IN('M','D')
GROUP BY Category
QUERY OUTPUT:
Category ...