# Group matched records

Join / match group

turn matched pairs into one group id per record, following matches transitively

Page: <https://meridian.online/operations/group-matched-records>

## Status

Runs as a SQL step.

arcform carries it as a `sql:` step today.

## The DuckDB step

matched pairs become one group id per record

```sql
WITH RECURSIVE pairs(a, b) AS (VALUES (1, 2), (2, 3), (4, 5)),
     edges AS (SELECT a, b FROM pairs UNION SELECT b, a FROM pairs),
     nodes AS (SELECT a AS id FROM edges UNION SELECT 6),
     reach(id, member) AS (SELECT id, id FROM nodes UNION SELECT r.id, e.b FROM reach r JOIN edges e ON e.a = r.member),
     grouped AS (SELECT id, min(member) AS group_id FROM reach GROUP BY id)
SELECT id, group_id,
       CASE WHEN (id, group_id) IN ((1, 1), (2, 1), (3, 1), (4, 4), (5, 4), (6, 6)) THEN 'ok'
            ELSE error('record ' || id || ' was put in group ' || group_id) END AS verdict
FROM grouped ORDER BY id;
```

The statement builds its own data.

It needs nothing installed beyond DuckDB itself.

## What other tools call it

Meridian's classification; an independent blind rating agreed on 86.2% of 312 rows (exact class, version 2).

- Alteryx Designer: [`Make Group`](https://help.alteryx.com/current/en/designer/tools/join/make-group-tool.html) (read 2026-09-27)
- Duckle: [`Match Grouping (Cluster IDs)`](https://github.com/slothflowlabs/duckle/blob/f85f8960edfb6efbf4cb89d58a7b32e16df0e867/frontend/src/workflow-ui/palette-data.ts) (read 2026-09-25)
- Power Query M: [`Table.FuzzyGroup`](https://learn.microsoft.com/en-us/powerquery-m/table-functions#transformation) (read 2026-09-27)
- Talend: [`tMatchGroup`](https://help.qlik.com/talend/en-US/components/8.0/data-matching/data-matching-component) (read 2026-09-27)
