MERGE
All functions > ROW > MERGE
Merges multiple row structures into a single row with combined fields
Syntax
Diagram(
Sequence(
Terminal("MERGE"),
Terminal("("),
NonTerminal("row"),
Terminal(","),
OneOrMore(NonTerminal("row"), Terminal(",")),
Terminal(")"),
)
)| Parameter | Type | Required | Description |
|---|---|---|---|
row | ROW | Yes | Row expression to merge |
Notes
- Requires at least 2 rows to merge
- All field names must be unique across all rows
- Fields are combined in order from left to right
- Throws error if duplicate field names exist
Examples
FeatureQL
SELECT
f1 := MERGE(ROW(1 AS col1, 'a' AS col2), ROW(1e0 AS col3, TRUE AS col4)), -- Merge two rows with different fields
f2 := MERGE(ROW(1 AS col1, 'a' AS col2), ROW(1e0 AS col3, TRUE AS col4), ROW(1 AS col5)) -- Merge three rows
;Result
| f1 ROW | f2 ROW |
|---|---|
| {col1: 1, col2: a, col3: 1.0, col4: true} | {col1: 1, col2: a, col3: 1.0, col4: true, col5: 1} |