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(")"),
  )
)
ParameterTypeRequiredDescription
rowROWYesRow 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 ROWf2 ROW
{col1: 1, col2: a, col3: 1.0, col4: true}{col1: 1, col2: a, col3: 1.0, col4: true, col5: 1}

Last update at: 2026/03/03 16:47:38
Last updated: 2026-03-03 16:48:19