SoQL also provides a limited amount of aggregation functionality through its GROUP BY clause. GROUP BY must be used in conjunction with SELECT to provide the aggregation functions you wish to use. For example, to find the strongest earthquake by region, we want to $group by region and provide a $select of region, MAX(magnitude):
The TryIt macro has been disabled until future notice while we upgrade this site to SODA3.
The currently supported grouping expressions are:
| Function | Datatypes Supported | Description |
|---|---|---|
sum |
Number | Sums up all the values in a grouping |
count |
All | Counts the number of values. null values are not counted |
avg |
Number | Finds the average value of numbers in this column |
min |
Number | Finds the minimum value of numbers in this column |
max |
Number | Finds the maximum value of numbers in this column |