Generates totals that appear as additional summary columns at the end of the result set. When used with BY, the COMPUTE clause generates control-breaks and subtotals in the result set.
USE Database;
GO
SELECT CustomerID, OrderDate, SubTotal, TotalDue
FROM Sales.SalesOrderHeader
WHERE ID = 1
ORDER BY OrderDate
COMPUTE SUM(SubTotal), SUM(TotalDue);
Thursday, April 30, 2009
COMPUTE (Transact-SQL) - SQL Server 2005
Posted by Emil Chang at 9:31 PM
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment