VeloDB Cloud
SQL Reference
SQL Functions
Aggregate Functions
GROUP_ARRAY_INTERSECT

GROUP_ARRAY_INTERSECT

Description

Calculate the intersection elements of the input array across all rows and return a new array.

Syntax

GROUP_ARRAY_INTERSECT(<expr>)

Parameters

ParameterDescription
<expr>Array columns or array values that require intersection

Return Value

Returns an array containing the intersection results

Example

select c_array_string from group_array_intersect_test where id in (18, 20);
+------+---------------------------+
| id   | col                       |
+------+---------------------------+
|    1 | ["a", "b", "c", "d", "e"] |
|    2 | ["a", "b"]                |
|    3 | ["a", null]               |
+------+---------------------------+
select group_array_intersect(col) from group_array_intersect_test;
+----------------------------+
| group_array_intersect(col) |
+----------------------------+
| ["a"]                      |
+----------------------------+