ARRAY_ZIP
Descriptionβ
Merges all arrays into a single array. The resulting array contains corresponding elements from the source arrays, grouped in the order of the argument list.
Syntaxβ
ARRAY_ZIP(<array>[, <array> ])
Parametersβ
Parameter | Description |
---|---|
<array> | Input array |
Return Valueβ
Returns an array with the elements from the source array grouped into a structure. The data types in the structure are the same as the input array and are in the order in which the array was passed.
Exampleβ
SELECT ARRAY_ZIP(['a', 'b', 'c'], [1, 2, 3]);
+--------------------------------------------------------+
| array_zip(['a', 'b', 'c'], [1, 2, 3]) |
+--------------------------------------------------------+
| [{"1":"a", "2":1}, {"1":"b", "2":2}, {"1":"c", "2":3}] |
+--------------------------------------------------------+