All Products
Search
Document Center

MaxCompute:ANY

Last Updated:Mar 26, 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. A Boolean expression.

Return value

Returns a value of the BOOLEAN type.

  • Returns true if at least one element in expr is true.

  • Returns false if all elements in expr are false.

  • NULL values in expr are excluded from 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);