All Products
Search
Document Center

MaxCompute:ANY

Last Updated:Sep 21, 2026

Returns True if at least one element in the input data is True, otherwise returns False.

Syntax

BOOLEAN ANY(BOOLEAN <expr>)

Parameters

  • expr: Required. An expression of the BOOLEAN type.

Return value

Returns a BOOLEAN type. The return value varies based on the following rules:

  • If at least one element in the input expr is true, the function returns true. If all elements are false, the function returns false.

  • If the input expr contains NULL values, the NULL values are not included in the calculation.

Examples

-- Returns true
SELECT ANY(colname) FROM VALUES (true), (false), (false) AS tab(colname);
-- Returns true
SELECT ANY(colname) FROM VALUES (NULL), (true), (false) AS tab(colname);
-- Returns false
SELECT ANY(colname) FROM VALUES (false), (false), (NULL) AS tab(colname);
-- Returns true
SELECT ANY(colname1) FILTER(WHERE colname2 = 2) FROM VALUES (true, 1), (FALSE, 1), (true, 2) AS tab(colname1, colname2);