---
title: any aggregate function
description: Learn the syntax of the any aggregate function of the SQL language in Databricks SQL and Databricks Runtime.
canonical_url: https://docs.databricks.com/aws/en/sql/language-manual/functions/any
---

# `any` aggregate function

**Applies to:** ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks SQL ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks Runtime

Returns `true` if at least one value of `expr` in the group is true.
The `any` aggregate function is synonymous with [`max` aggregate function](https://docs.databricks.com/aws/en/sql/language-manual/functions/max.md), but limited to a boolean argument.
The function is also a synonym for [`bool_or` aggregate function](https://docs.databricks.com/aws/en/sql/language-manual/functions/bool_or.md).

## Syntax

```
any(expr) [FILTER ( WHERE cond ) ]
```

This function can also be invoked as a [window function](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-window-functions.md) using the `OVER` clause.

## Arguments

* `expr`: A `BOOLEAN` expression.
* `cond`: An optional `BOOLEAN` expression filtering the rows used for aggregation.

## Returns

A `BOOLEAN`.

## Examples

```sql
> SELECT any(col) FROM VALUES (true), (false), (false) AS tab(col);
 true

> SELECT any(col) FROM VALUES (NULL), (true), (false) AS tab(col);
 true

> SELECT any(col) FROM VALUES (false), (false), (NULL) AS tab(col);
 false

> SELECT any(col1) FILTER (WHERE col2 = 1)
    FROM VALUES (false, 1), (false, 2), (true, 2), (NULL, 1) AS tab(col1, col2);
 false
```

## Related

* [`bool_or` aggregate function](https://docs.databricks.com/aws/en/sql/language-manual/functions/bool_or.md)
* [`max` aggregate function](https://docs.databricks.com/aws/en/sql/language-manual/functions/max.md)
* [`min` aggregate function](https://docs.databricks.com/aws/en/sql/language-manual/functions/min.md)
* [`some` aggregate function](https://docs.databricks.com/aws/en/sql/language-manual/functions/some.md)
* [Window functions](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-window-functions.md)
