You can use aggregate functions in dynamic queries.
When using the Query.Select(String) method, you can use any of these aggregate functions:
| Aggregate Function | Supported Datatypes | 
|---|---|
| COUNT | integer | 
| MAX | string, binary, char, byte, short, int, long, integer, decimal, float, double, date, time, dateTime | 
| MIN | string, binary, char, byte, short, int, long, integer, decimal, float, double, date, time, dateTime | 
| SUM | byte, short, int, long, integer, decimal, float, double | 
| AVG | byte, short, int, long, integer, decimal, float, double | 
If you use an unsupported type, a PersistenceException is thrown.
Query query1 = new Query();
query1.Select("MAX(c.id), MIN(c.name) as minName");
For iOS, we need a code sample equivalent to this WM sample: