> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wherobots.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ST_Collect_Agg

Collects all geometries in a geometry column into a single multi-geometry (MultiPoint, MultiLineString, MultiPolygon, or GeometryCollection). Unlike `ST_Union_Agg`, this function does not dissolve boundaries between geometries - it simply collects them into a multi-geometry.

<img src="https://mintcdn.com/wherobots/fqh3gPDE0J25Lra_/images/sql-functions/ST_Collect_Agg/ST_Collect_Agg.svg?fit=max&auto=format&n=fqh3gPDE0J25Lra_&q=85&s=23591e2471ec44692ad30030c4abcf81" alt="ST_Collect_Agg" width="400" height="130" data-path="images/sql-functions/ST_Collect_Agg/ST_Collect_Agg.svg" />

## Signatures

```sql theme={"system"}
ST_Collect_Agg (A: geometryColumn)
```

## Parameters

<ParamField body="A" type="geometryColumn" required>
  The input geometry.
</ParamField>

## Return type

<ResponseField type="Geometry">
  The resulting geometry.
</ResponseField>

## Examples

```sql theme={"system"}
SELECT ST_Collect_Agg(geom) FROM (
  SELECT ST_GeomFromWKT('POINT(1 2)') AS geom
  UNION ALL
  SELECT ST_GeomFromWKT('POINT(3 4)') AS geom
  UNION ALL
  SELECT ST_GeomFromWKT('POINT(5 6)') AS geom
)
```

```
MULTIPOINT ((1 2), (3 4), (5 6))
```

### with GROUP BY

```sql theme={"system"}
SELECT category, ST_Collect_Agg(geom) FROM geometries GROUP BY category
```
