ELEMENTS_AT_KEY

All functions > ARRAY > ELEMENTS_AT_KEY

Returns multiple elements at the given key from the given index, array or array of rows.

Syntax

ELEMENTS_AT_KEY(index: INDEX, key: K, base: ARRAY<ROW<T>>) → ARRAY<ROW<T>>
sql

Type Parameters:

  • K: Any hashable type

  • T: Any type

Arguments

ParameterTypeRequiredDescription
indexINDEXYesIndex to look up positions from
keyKYesKey to look up in the index
baseARRAY<ROW<T>>YesArray or array of rows to extract elements from

Returns

ARRAY<ROW<T>> - Multiple elements at the positions indicated by index[key]

Notes

  • Uses index to map key to multiple array positions
  • Looks up key in index to find array of positions
  • Returns elements at those positions from base array
  • Returns empty array if key not found in index
  • Useful for one-to-many lookups with multi-valued indexes
Last update at: 2025/10/13 10:23:46