Aggregate Functions
COUNT
Returns the number of rows matching the query criteria.
SELECT COUNT(*) FROM res_users WHERE company_name = 'Company Inc.'
COUNT(DISTINCT)
Returns the number of distinct, non-null field values matching the query criteria.
SELECT COUNT(DISTINCT name) AS DistinctValues FROM res_users WHERE company_name = 'Company Inc.'
AVG
Returns the average of the column values.
SELECT email, AVG(meeting_count) FROM res_users WHERE company_name = 'Company Inc.' GROUP BY email
MIN
Returns the minimum column value.
SELECT MIN(meeting_count), email FROM res_users WHERE company_name = 'Company Inc.' GROUP BY email
MAX
Returns the maximum column value.
SELECT email, MAX(meeting_count) FROM res_users WHERE company_name = 'Company Inc.' GROUP BY email
SUM
Returns the total sum of the column values.
SELECT SUM(meeting_count) FROM res_users WHERE company_name = 'Company Inc.'