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