# Merge

Combine two lists: append, join by key, or pair by position.

## Do things in Merge

Add a **Merge** step and choose a **Mode**. Choose the row to see the fields of each.

- [Merge](https://docs.gorunner.io/apps/merge#fields-f-merge): Append (concatenate) · Combine by matching key · Combine by position (zip) · Cross-join (all combinations)

Later steps read a step’s output by its name: see [Use data from earlier steps](https://docs.gorunner.io/build/use-data-from-earlier-steps).

Not in your list? See [When an app isn’t here](https://docs.gorunner.io/apps/when-an-app-isnt-here#q-not-in-list).

## For developers

In the API, which calls apps pieces, Merge is `pieceId: "merge"` with `actionId: "merge"`, set by `mode`. [Get an app](https://docs.gorunner.io/api/apps/get-app) returns every field.

It computes from its inputs only (`pure`). See [How versions and side effects work](https://docs.gorunner.io/apps#q-versions).

### Merge › Merge

Combine input A and input B into a single array.

### Append (concatenate) and Cross-join (all combinations)

- **Input A · Required**: First array, such as {{steps.fetch_users.rows}}.
- **Input B · Required**: Second array, such as {{steps.fetch_orders.rows}}.

### Combine by matching key

- **Input A · Required**: First array, such as {{steps.fetch_users.rows}}.
- **Input B · Required**: Second array, such as {{steps.fetch_orders.rows}}.
- **Key field(s) in A · Required**: Field in A to match on (such as id). For a composite key, list several comma-separated (paired positionally with B).
- **Key field(s) in B · Optional**: Field in B to match on. Defaults to the same as A. For a composite key, list the same number of comma-separated fields as A.
- **Join · Optional**: How to combine the two lists. Options: Inner: only rows that match, Left: all of A, enriched by B, Right: all of B, enriched by A, Outer: everything from both, Non-matches only: rows in A or B with no match. Default: Inner: only rows that match.

### Combine by position (zip)

- **Input A · Required**: First array, such as {{steps.fetch_users.rows}}.
- **Input B · Required**: Second array, such as {{steps.fetch_orders.rows}}.
- **Include Unpaired Items · Optional**: When zipping by position and the lists differ in length: on (default) pads to the longer list, leaving the missing side empty; off stops at the shorter list. On by default.

Source: https://docs.gorunner.io/apps/merge
