MERGE(...)
All functions > ROW > MERGE(...)
Merges multiple row structures into a single row with combined fields
Syntax
MERGE(row, row, ...)
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
-- Merge two rows with different fields
f1 := MERGE(ROW(1 AS col1, 'a' AS col2), ROW(1e0 AS col3, TRUE AS col4)),
-- Merge three rows
f2 := MERGE(
ROW(1 AS col1, 'a' AS col2),
ROW(1e0 AS col3, TRUE AS col4),
ROW(1 AS col5)
)
;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} |