O'Reilly logo

Development with the Force.com Platform: Building Business Applications in the Cloud, Third Edition by Jason Ouellette

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Aggregate Functions

Aggregate functions in SOQL work much like their SQL counterparts. They are applied to fields in the SELECT list. After you include an aggregate function in a query, nonaggregate fields in the same query are not allowed. The six aggregate functions available in SOQL are

Image AVGCalculates an average of the values in a numeric field.

Image COUNTCounts the values in a numeric, date, or string field, including duplicate values but not nulls. Unlike all other aggregate functions, the argument to COUNT is optional.

COUNT_DISTINCTCounts ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required