---
title: "Aggregating"
description: "Counting, adding up and averaging is written as a group by in the statement, and the engine has the platform do the work where the platform can."
language: en
source_language: en
translation_state: complete
canonical: https://documentation.invantive.eu/en/docs/invantive-query-tool/aggregating
original: https://documentation.invantive.eu/en/docs/invantive-query-tool/aggregating
updated: 2026-09-04T00:00:00Z
license: https://documentation.invantive.eu/en/
---

Counting, adding up and averaging is written as a `group by` in the statement, and the engine has the platform do the work where the platform can. That is the difference with the summaries of the grid, which count what has already arrived; see [[Invantive Query Tool/Sorting and Filtering Rows|Sorting and Filtering Rows]].

## An Example
Over the [[Invantive Query Tool/Sample Database|sample database]]:

```sql
select pjt_gemeente
,      count(*) aantal
,      min(pjt_code) eerste
from   Projects@dummy
group
by     pjt_gemeente
order
by     aantal desc
```

Five municipalities, six projects in the largest:
![The "Results" panel of Invantive Query Tool showing five municipalities with a "Number of Rows" column from an aggregate.](/img/989726a02e524c1d785830698d67030c22ac7e3b2496bd8f9af2ee4ec38b4617/900x410.png)

The heading of a counted column reads "Number of Rows" rather than the alias: a column which the engine recognises is labelled with what it means, and an alias of its own is shown as written. Which label a column carries is decided by the metadata, not by the grid.

## Where the Work Happens
An aggregate over a database - Microsoft SQL Server, Oracle, PostgreSQL, MySQL - is pushed down: the platform counts and returns the answer. Over a cloud platform which cannot count on its own the engine reads the rows and counts them itself, and the traffic is then the whole table rather than the answer. Which of the two happened is visible in the [[Invantive Query Tool/Connection Monitor|Connection Monitor]] as bytes received, and in the [[Invantive Query Tool/Progress|Progress]] panel as the rows which passed the step.

That is worth knowing before an aggregate over a large cloud table is repeated every morning: the [[Invantive Query Tool/Data Cache|data cache]] exists for exactly that case.

## The Functions
The group functions - `count`, `sum`, `min`, `max`, `avg`, `stddev` and the rest - and what may stand in a `having` are documented under [[Invantive UniversalSQL/General/Group Functions|Group Functions]] and [[Invantive UniversalSQL/General/Grouping|Grouping]].

## Release Notes

- [Invantive Query Tool for Windows](/en/release-notes/products/invantive-query-tool)
  - [26.0 to 27.0](/en/release-notes/products/invantive-query-tool?step=26.0-to-27.0)
  - [25.0 to 26.0](/en/release-notes/products/invantive-query-tool?step=25.0-to-26.0)

