Mendix 7 is no longer supported unless you have Extended Support (for details, please contact Mendix Support). Mendix 7 documentation will remain available for customers with Extended Support until July, 2024.

OQL Group by Clause

Last modified: August 2, 2022

The GROUP BY clause will condense all returned rows into a single row that shares the same values for the expressions defined in this clause. The expressions in this clause must exist in the SELECT clause of the query. All expressions in the SELECT clause which do not exist in the GROUP BY clause must be either an aggregation or the result an aggregate function.

The syntax is as following:

1
2
3
4
GROUP BY
    expression [ ,...n ]

[HAVING <constraint>]

expression Specifies the expressions by which values of the rows are grouped.

HAVING <constraint> Specifies a constraint. When a GROUP BY expression is used, constraints must be defined in a HAVING clause.