Are there array arithmetic functions for arrays, like subtract each element of an array from another array elements?
:) SELECT arraySub([5,6,7], [1,2,3]) as sub
result:
sub
[4,4,4]
Hi!
You could use lambdas:
SELECT arrayMap((a, b) -> (a - b), [5, 6, 7], [1, 2, 3])
ββarrayMap(lambda(tuple(a, b), minus(a, b)), [5, 6, 7], [1, 2, 3])ββ
β [4,4,4] β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
1 rows in set. Elapsed: 0.001 sec.
More details about higher-order functions: https://clickhouse.yandex/docs/en/single/#higher-order-functions
Most helpful comment
Hi!
You could use lambdas: