---
title: "Group Functions"
description: "The Invantive implementation of SQL is based upon ANSI SQL, extended by aspects from popular SQL implementations such as PostgreSQL, MySQL, Oracle\u2026"
language: en
source_language: en
translation_state: complete
canonical: https://documentation.invantive.eu/en/docs/invantive-universalsql/general/group-functions
original: https://documentation.invantive.eu/en/docs/invantive-universalsql/general/group-functions
updated: 2026-11-05T00:00:00Z
license: https://documentation.invantive.eu/en/
---

The Invantive implementation of SQL is based upon ANSI SQL, extended by aspects from popular SQL implementations such as PostgreSQL, MySQL, Oracle, Teradata and Microsoft SQL Server. It is topped of with Invantive-specific extensions, especially for distributed SQL and distributed transactions. The basis is to implement functions such that as little as possible changes are necessary to run a SQL statement originating from another SQL implementation on Invantive UniversalSQL. For instance, to retrieve the current time you can use `sysdate`, `now`, `getdate()` and `sysdatetime` to name a few.

Popular group functions such as `stddev` are available. From release 28.0 group functions and expressions on them can be combined in the select list and in the [[Invantive UniversalSQL/General/Grouping#Filtering Groups with Having|having clause]], such as `sum(amount) + 1`, `round(avg(amount), 2)`, `sum(amount) / count(*)` or `case when count(*) > 1 then 'many' else 'one' end`. A column outside a group function must then be one the statement groups by. A group function can not be used inside another group function, nor in a `where` clause, a join condition or an `order by`; sort on the alias or the position of the select list instead. Before release 28.0 use an inner (nested) SQL statement for the group functions and apply the expressions in the outer SQL statement, with the syntax `select expression(v.total) from ( select group() total from ... ) v`.

## Group Functions Answered by the Platform
A statement whose whole select list is a group function over one table does not need the rows. As of release 27.0 Invantive UniversalSQL asks the data container for the values instead. A count over a million rows is then one question rather than a million answers. The `where` clause travels with the question. A filter on text stays behind on a platform which compares text otherwise than Invantive UniversalSQL, such as Exact Online, which ignores upper and lower case. The rows are then read as before, so that the answer stays the same.

Four functions take this route: `count(*)`, `min`, `max` and `sum`. The answer is the same either way. Only the work changes.

A platform which can not count, but pages with an offset, is spared most of the reading for `count(*)` all the same, mostly only without a filter. The first five pages are read, whatever their size, and when the list is longer, the remainder is found by asking for one row at ever larger offsets. A list of 100,000 rows in pages of 500 then takes about 20 questions instead of 200. This applies to SnelStart, Brevo, ActiveCampaign, Simplicate, Nextcloud, Crisp and OpenSpending.

```sql
select count(*)
,      min(gla.Code)
,      max(gla.Code)
from   ExactOnlineREST..GLAccounts gla
where  gla.IsBlocked = false
```