Aggregate Functions
COUNT
Returns the number of rows matching the query criteria.
SELECT COUNT(*) FROM Accounts WHERE DisplayOrder = '12'
COUNT(DISTINCT)
Returns the number of distinct, non-null field values matching the query criteria.
SELECT COUNT(DISTINCT Id) AS DistinctValues FROM Accounts WHERE DisplayOrder = '12'
AVG
Returns the average of the column values.
SELECT LookupName, AVG(AnnualRevenue) FROM Accounts WHERE DisplayOrder = '12' GROUP BY LookupName
MIN
Returns the minimum column value.
SELECT MIN(AnnualRevenue), LookupName FROM Accounts WHERE DisplayOrder = '12' GROUP BY LookupName
MAX
Returns the maximum column value.
SELECT LookupName, MAX(AnnualRevenue) FROM Accounts WHERE DisplayOrder = '12' GROUP BY LookupName
SUM
Returns the total sum of the column values.
SELECT SUM(AnnualRevenue) FROM Accounts WHERE DisplayOrder = '12'