array_apply
array_apply
description
数组以特定的二元条件符过滤元素, 并返回过滤后的结果
Syntax
array_apply(arr, op, val)
Arguments
arr
— 输入的数组, 如果是null, 则返回null
op
— 过滤条件, 条件包括 =
, >=
, <=
, >
, <
, !=
,仅支持常量
val
— 过滤的条件值, 如果是null, 则返回null,仅支持常量
Returned value
过滤后的数组
类型: Array.
example
mysql> select array_apply([1, 2, 3, 4, 5], ">=", 2);
+--------------------------------------------+
| array_apply(ARRAY(1, 2, 3, 4, 5), '>=', 2) |
+--------------------------------------------+
| [2, 3, 4, 5] |
+--------------------------------------------+
1 row in set (0.01 sec)
mysql> select array_apply([1000000, 1000001, 1000002], "=", "1000002");
+-------------------------------------------------------------+
| array_apply(ARRAY(1000000, 1000001, 1000002), '=', 1000002) |
+-------------------------------------------------------------+
| [1000002] |
+-------------------------------------------------------------+
1 row in set (0.01 sec)
keywords
ARRAY,APPLY,ARRAY_APPLY