JSON_ARRAY_REDUCE
Reduces a JSON array to a single value by applying a specified Lambda expression. For more information about Lambda expression, see Lambda Expressions.
SQL Syntax
JSON_ARRAY_REDUCE(<json_array>, <lambda_expression>)
SQL Examples
This example multiplies all the elements in the array (2 _ 3 _ 4):
SELECT JSON_ARRAY_REDUCE(
[2, 3, 4]::JSON,
(acc, d) -> acc::Int * d::Int
);
-[ RECORD 1 ]-----------------------------------
json_array_reduce([2, 3, 4]::VARIANT, (acc, d) -> acc::Int32 * d::Int32): 24