When you need an extra summarization column about your selects you may use that command..Also it is not able to use with Group By command
In the following example, the SELECT statement uses a simple COMPUTE clause to produce a grand total of the sum of the SubTotal and TotalDue from the SalesOrderHeader table.
USE AdventureWorks;
GO
SELECT CustomerID, OrderDate, SubTotal, TotalDue
FROM Sales.SalesOrderHeader
WHERE SalesPersonID = 35
ORDER BY OrderDate
COMPUTE SUM(SubTotal), SUM(TotalDue);
.......
more details are in the msdn
No comments:
Post a Comment