SQL SERVER 2008 / Transact-SQL supports following aggregate functions:
AVG: Calculates the arithmetic mean (average) of the data values contained within a column. The column must contain numeric values.
MAX and MIN: Calculate the maximum and minimum data value of the column, respectively. The column can contain numeric, string, and date/time values.
SUM: Calculates the total of all data values in a column. The column must contain numeric values.
COUNT: Calculates the number of (non-null) data values in a column. The only aggregate function not being applied to columns is COUNT(*). This function returns the number of rows (whether or not particular columns have NULL values).
COUNT_BIG: New and Analogous to COUNT, the only difference being that COUNT_BIG returns a value of the BIGINT data type.
Example:
SELECT Name, SUM(Fee) TotalLoan FROM Fee_Tbl GROUP BY Name;
Related Topic: |