Hi all I have written a query to display the sum of quantity as follows without group by
SELECT ISNULL(SUM(VUItems.Quantity), 0) AS OrderQty
FROM VUItems
This returns as 0.00
but the same query when using group by
not displaying 0.00
what might be the problem
SELECT ISNULL(SUM(VUItems.Quantity), 0) AS OrderQty
FROM VUItems
GROUP BY SKU,
SalesOrderNo
Why I need is that I will have a table which will have the quantity on saving this is what I have written to display the Quantity ordered or user eneterd as follows
SELECT VU1.*,
VU1.Quantity - (SELECT ISNULL(SUM(VU2.Quantity), 0) AS OrderQty
FROM VU2
WHERE VU1.SKU = VU2.SKU
AND VU1.SalesOrderNo = VU2.SalesOrderNo
GROUP BY SKU) AS orderedQuantity
FROM VU1
with out group by it is displaying orderedQuantity
as required but with group by it is showing null