Click to Rate and Give Feedback
MSDN
MSDN Library
SQL Server
SQL Server 2008
Database Engine
Technical Reference
 Aggregate Functions (Transact-SQL)
Community Content
In this section
Statistics Annotations (0)
Collapse All/Expand All Collapse All
Other versions are also available for the following:
SQL Server 2008 Books Online (October 2009)
Aggregate Functions (Transact-SQL)

Aggregate functions perform a calculation on a set of values and return a single value. Except for COUNT, aggregate functions ignore null values. Aggregate functions are frequently used with the GROUP BY clause of the SELECT statement.

All aggregate functions are deterministic. This means aggregate functions return the same value any time that they are called by using a specific set of input values. For more information about function determinism, see Deterministic and Nondeterministic Functions. The OVER clause may follow all aggregate functions except CHECKSUM.

Aggregate functions can be used as expressions only in the following:

  • The select list of a SELECT statement (either a subquery or an outer query).
  • A COMPUTE or COMPUTE BY clause.
  • A HAVING clause.

Transact-SQL provides the following aggregate functions:

AVG

MIN

CHECKSUM_AGG

SUM

COUNT

STDEV

COUNT_BIG

STDEVP

GROUPING

VAR

MAX

VARP

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker