# Join on approximate matches

Join / fuzzy

approximate string match join

Page: <https://meridian.online/operations/join-on-approximate-matches>

## Status

Runs as a SQL step.

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

## The DuckDB step

match names by string similarity

It reads the `orders` and `customers` tables the proofs share. Create them first:

```sql
CREATE TABLE orders AS SELECT * FROM (VALUES
  (1,  'Alice Ng',      'north', DATE '2026-01-03', 120.00, 'widget', 'a|b',   '{"channel":"web","items":[1,2]}'),
  (2,  'alice ng',      'north', DATE '2026-01-05',  80.50, 'gadget', 'b',     '{"channel":"shop","items":[3]}'),
  (3,  'Bob  Okafor',   'south', DATE '2026-01-05', 300.00, 'widget', 'a|c',   '{"channel":"web","items":[4,5,6]}'),
  (4,  'Carla Díaz',    'east',  DATE '2026-01-09',  NULL,  'gizmo',  NULL,    '{"channel":"web","items":[]}'),
  (5,  'Bob Okafor',    'south', DATE '2026-01-12',  45.25, 'gadget', 'c',     '{"channel":"phone","items":[7]}'),
  (6,  'Dev Patel',     'west',  DATE '2026-01-12', 510.00, 'widget', 'a',     '{"channel":"web","items":[8,9]}'),
  (7,  'Carla Diaz',    'east',  DATE '2026-01-20',  99.99, 'gizmo',  'b|c',   '{"channel":"shop","items":[10]}'),
  (8,  'Dev Patel',     'west',  DATE '2026-02-02', 510.00, 'widget', 'a',     '{"channel":"web","items":[8,9]}'),
  (9,  'Eve Larsen',    NULL,    DATE '2026-02-03',  15.00, 'gadget', NULL,    '{"channel":"web","items":[11]}'),
  (10, 'Alice Ng',      'north', DATE '2026-02-10', 220.00, 'gizmo',  'a|b|c', '{"channel":"phone","items":[12,13]}')
) t(order_id, customer, region, order_date, amount, product, tags, meta);

CREATE TABLE customers AS SELECT * FROM (VALUES
  ('Alice Ng',    'retail',    DATE '2025-06-01', 52.52, 13.40),
  ('Bob Okafor',  'wholesale', DATE '2025-09-15', 48.85,  2.35),
  ('Carla Diaz',  'retail',    DATE '2025-11-30', 40.42, -3.70),
  ('Frank Moore', 'retail',    DATE '2026-01-01', 51.51, -0.13)
) t(customer, segment, joined, lat, lon);
```

Then run the statement:

```sql
CREATE TEMP TABLE result AS
SELECT DISTINCT o.customer AS as_written, c.customer AS matched, round(jaro_winkler_similarity(lower(o.customer), lower(c.customer)), 3) AS score
FROM orders o JOIN customers c ON jaro_winkler_similarity(lower(strip_accents(o.customer)), lower(c.customer)) >= 0.92
ORDER BY score;
SELECT * FROM result ORDER BY ALL;
SELECT CASE WHEN ((SELECT count(*) = 6 AND count(*) FILTER (WHERE as_written IN ('Dev Patel', 'Eve Larsen')) = 0 AND max(matched) FILTER (WHERE as_written = 'Bob  Okafor') = 'Bob Okafor' AND max(matched) FILTER (WHERE as_written = 'Carla Díaz') = 'Carla Diaz' FROM result)) THEN 'as expected' ELSE error('a misspelt name did not match, or a stranger did') END AS verdict;
```

It needs nothing installed beyond DuckDB itself.

## Variants

- Generate candidate pairs: Limit comparisons to pairs of records that share a blocking key before scoring them.
- Join on similar keys: Join two tables where key values are similar enough by a string similarity measure and threshold.
- [Find near-duplicate rows](https://meridian.online/operations/join-on-approximate-matches/find-near-duplicate-rows): Compare the rows of one table with each other and flag or drop those whose keys nearly match.
- Score the similarity of two strings: Add a column with the similarity or distance between two string values.

## 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: [`Fuzzy Match`](https://help.alteryx.com/current/en/designer/tools/join/fuzzy-match-tool.html) (read 2026-09-27)
- Duckle: [`Candidate Pairs (Blocking)`](https://github.com/slothflowlabs/duckle/blob/f85f8960edfb6efbf4cb89d58a7b32e16df0e867/frontend/src/workflow-ui/palette-data.ts) (read 2026-09-25)
- Duckle: [`Fuzzy Deduplicate`](https://github.com/slothflowlabs/duckle/blob/f85f8960edfb6efbf4cb89d58a7b32e16df0e867/website/docs/components.html) (read 2026-09-25)
- Duckle: [`Record Linkage`](https://github.com/slothflowlabs/duckle/blob/f85f8960edfb6efbf4cb89d58a7b32e16df0e867/frontend/src/workflow-ui/palette-data.ts) (read 2026-09-25)
- Duckle: [`Record Match`](https://github.com/slothflowlabs/duckle/blob/f85f8960edfb6efbf4cb89d58a7b32e16df0e867/website/docs/components.html) (read 2026-09-25)
- Duckle: [`Text Similarity`](https://github.com/slothflowlabs/duckle/blob/f85f8960edfb6efbf4cb89d58a7b32e16df0e867/website/docs/components.html) (read 2026-09-25)
- Apache Hop: [`Fuzzy match`](https://hop.apache.org/manual/latest/pipeline/transforms/fuzzymatch.html) (read 2026-09-27)
- Pentaho Data Integration: [`Fuzzy match`](https://docs.pentaho.com/pdia-data-integration/9.3-data-integration/pdi-transformation-steps-reference-overview) (read 2026-09-27)
- Power Query M: [`Table.FuzzyJoin`](https://learn.microsoft.com/en-us/powerquery-m/table-functions#transformation) (read 2026-09-27)
- Power Query M: [`Table.FuzzyNestedJoin`](https://learn.microsoft.com/en-us/powerquery-m/table-functions#transformation) (read 2026-09-27)
- Talend: [`tBlockedFuzzyJoin`](https://help.qlik.com/talend/en-US/components/8.0/fuzzy-matching/fuzzy-matching-component) (read 2026-09-27)
- Talend: [`tFuzzyJoin`](https://help.qlik.com/talend/en-US/components/8.0/fuzzy-matching/fuzzy-matching-component) (read 2026-09-27)
- Talend: [`tFuzzyMatch`](https://help.qlik.com/talend/en-US/components/8.0/fuzzy-matching/fuzzy-matching-component) (read 2026-09-27)
- Talend: [`tFuzzyUniqRow`](https://help.qlik.com/talend/en-US/components/8.0/fuzzy-matching/fuzzy-matching-component) (read 2026-09-27)
- Talend: [`tMatchPairing`](https://help.qlik.com/talend/en-US/components/8.0/matching-with-machine-learning/matching-with-machine-learning-component) (read 2026-09-27)
- Talend: [`tRecordMatching`](https://help.qlik.com/talend/en-US/components/8.0/data-matching/data-matching-component) (read 2026-09-27)
