Skip to content

Aggregate Functions Overview

In addition to retrieving the data from the Backendless database, your app may also need to perform some additional calculations on the data before it is retrieved. For example, you may need to know the average age of users from a geographic area or the sum of all orders containing a specific product. To perform such calculations, you can use aggregate functions in a Backendless query.

Backendless supports several aggregate functions, including average, count, sum, min and max.

To understand how aggregate functions work in Backendless, consider the following example. It consists of three tables: Movie, Actor and Director.

movies-table-schema

The Movie table stores data about top grossing movies of all time. It also has related columns with the Actor (one to many) and the Director tables (one to one).

top-movies

Important

Results included in the response may include non-aggregated properties, such as objectId. These properties must be ignored. For example, when retrieving a max or min value for a set of data, objectId in the response does not identify the object with the maximum or minimum value.