The COMPUTE statement in this sproc gives me the following error when I attempt to save it in design mode.
Compute Clause #1, aggregate expression #1 is not in the select list
Can anyone tell me why? My objective is to get a sum of the GB and TB columns from the select statement as grand totals for all derivatives.
Thank you... Herb
SELECT DerivativeType , COUNT(DerivativeKey) AS DerivativeCount, SUM(GB) AS GB, SUM(TB) AS TB
WHERE ShipmentKey = @ShipmentKey AND QCPerson = 0
GROUP BY DerivativeType
COMPUTE COUNT(DerivativeKey), SUM(GB), SUM(TB)