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