This blog show how to use the SUM function to get the summation of values from a table using SQL.
Example:
SELECT AcctNumber,
SUM(TotalAmountDue) TotalDue
FROM DBO.SalesOrder
GROUP BY AcctNumber
ORDER BY AcctNumber
SUM() - this is the function used to get the summation.