Skip to content

Aggregate Functions

 

Aggregate functions operate on groups of records, rather than on individual records or variables. They are often used in combination with a GROUP BY clause.

The aggregate functions don't handle NULL in the same way as ordinary functions and operators. Instead of returning NULL as soon as a NULL operand is encountered, they only take non-NULL fields into consideration while computing the outcome.

Firebird aggregate functions

  • list() - returns a string consisting of the non-NULL argument values in the group
  • max() - returns the maximum argument value in the group. If the argument is a string, this is the value that comes last when the active collation is applied.
  • min() - returns the minimum argument value in the group. If the argument is a string, this is the value that comes first when the active collation is applied.
  • sum() - returns the sum of the argument value in the group.
  • ave() - returns the average of the argument value in the group
  • count() - returns the count of records in the group