VeloDB Cloud
SQL Manual
SQL Functions
Aggregate Functions
GROUP_ARRAY_INTERSECT

group_array_intersect

description

Syntax

expr GROUP_ARRAY_INTERSECT(expr)

calculate the intersect element from all arrays given, return a new array

example

mysql> select c_array_string from group_array_intersect_test where id in (18, 20);
+--------------------------------+
| c_array_string                 |
+--------------------------------+
| ["a", "b", "c", "d", "e", "f"] |
| ["a", null]                    |
+--------------------------------+
2 rows in set (0.02 sec)

mysql> select group_array_intersect(c_array_string) from group_array_intersect_test where id in (18, 20);
+---------------------------------------+
| group_array_intersect(c_array_string) |
+---------------------------------------+
| ["a"]                                 |
+---------------------------------------+
1 row in set (0.03 sec)

keywords

GROUP_ARRAY_INTERSECT, ARRAY