Was this page helpful?
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Collapse the table of content
Expand the table of content
Expand Minimize

AVG (SQL Server Compact Edition)

Returns the average of the values in a group. Null values are ignored.

AVG ( [ ALL ] expression ) 


Applies the aggregate function to all values. ALL is the default.


An expression of the exact numeric or approximate numeric data type categories, except for the bit data type. Aggregate functions and subqueries are not permitted.

The return type is determined by the type of the evaluated result of expression.

Expression result Return type

integer category


numeric category (p, s)

numeric(28, s) divided by numeric(10, 0)

money category


float and real category


The following example determines the average weight of products shipped to a company that has a CustomerID of '123'.

SELECT AVG(Weight) AS "Average Weight" FROM ShippingDetails WHERE CustomerID = '123' AND OrderID IN (10248, 10274, 10295)

This is the result set:

Average Weight
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2015 Microsoft