SUM

For this example I use the AdventureWorks2008DW database  and I’m processing the query inside MS SQL Management Studio 2008.

The SUM function in T-SQL returns the sum of the numeric values in a given column. The basic statement is SUM(“column name”). Inside the select statement it will look as follows:

SELECT SUM(SalesAmount)
FROM FactInternetSales

Above query will give you the total sum of the sales amount of all Internet Sales  regardless  the year, the sales person or anything else. There is no filter.I’ll soon go into more detail about how to get filtered results.

Tags:

About

View all posts by

POST A COMMENT