Aggregates
NoQL supports standard SQL aggregate functions with GROUP BY like SUM,AVG,MAX and MIN.
Aggregate results are returned as arrays for FIRSTN and LASTN.
Supported Aggregate Functions
SUM
SUM(field)
Returns the sum of all values in the given field.
Example SUM usage
AVG
AVG(field)
Returns the average of all values in the given field.
Example AVG usage
MIN
MIN(field)
Returns the minimum value in the given field.
Example MIN usage
MAX
MAX(field)
Returns the maximum value in the given field.
Example MAX usage
COUNT
COUNT(field)
Returns the count of rows in the given group.
Example COUNT usage
COUNT DISTINCT
COUNT(DISTINCT field)
Returns the distinct count of a specific field in the given group.
Example COUNT DISTINCT usage
FIRSTN
FIRSTN(limit)
Returns the first n records in the group as an array
Example FIRSTN usage
LASTN
LASTN(limit)
Returns the last n records in the group as an array
Example LASTN usage
SUM - CASE Logic
Sum Case logic is supported: