跳到主要内容
跳到主要内容

GROUP_ARRAY_INTERSECT

group_array_intersect

description

Syntax

expr GROUP_ARRAY_INTERSECT(expr)

求出所有行中输入数组中的交集元素,返回一个新的数组

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