ARRAY_LOOKUP
All functions > ARRAY > ARRAY_LOOKUP
Returns the value corresponding to a lookup key using parallel key-value arrays.
Signatures
Returns: The value at the same position as the key
ARRAY_LOOKUP(lookup_key: T, keys: ARRAY<T>, values: ARRAY<U>) → U sql
| Parameter | Type | Required | Description |
|---|---|---|---|
lookup_key | T | Yes | The key to search for |
keys | ARRAY<T> | Yes | Array of keys |
values | ARRAY<U> | Yes | Array of values (parallel to keys) |
Notes
- Uses two parallel arrays: one for keys, one for values
- Returns the value at the same index where the key is found
- Returns NULL if key is not found
- Only returns the first match if key appears multiple times
- Arrays must be same length
On this page