group_array_intersect

description

Syntax

expr GROUP_ARRAY_INTERSECT(expr)

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

example

  1. mysql> select c_array_string from group_array_intersect_test where id in (18, 20);
  2. +--------------------------------+
  3. | c_array_string |
  4. +--------------------------------+
  5. | ["a", "b", "c", "d", "e", "f"] |
  6. | ["a", null] |
  7. +--------------------------------+
  8. 2 rows in set (0.02 sec)
  9. mysql> select group_array_intersect(c_array_string) from group_array_intersect_test where id in (18, 20);
  10. +---------------------------------------+
  11. | group_array_intersect(c_array_string) |
  12. +---------------------------------------+
  13. | ["a"] |
  14. +---------------------------------------+
  15. 1 row in set (0.03 sec)

keywords

GROUP_ARRAY_INTERSECT, ARRAY