JSON_ARRAY_INTERSECT

JSON_ARRAY_INTERSECT is available from MariaDB 11.2.

Syntax

JSON_ARRAY_INTERSECT(arr1, arr2)

Description

Finds intersection between two json arrays and returns an array of items found in both array.

Examples

SET @json1= '[1,2,3]';
SET @json2= '[1,2,4]';

SELECT json_array_intersect(@json1, @json2); 
+--------------------------------------+
| json_array_intersect(@json1, @json2) |
+--------------------------------------+
| [1, 2]                               |
+--------------------------------------+

This page is licensed: CC BY-SA / Gnu FDL

Last updated

Was this helpful?