bool_and
彙總函式
適用于: Databricks SQL Databricks Runtime
如果 群組 expr
內的所有值都是 true,則會傳回 true。
語法
bool_and(expr) [FILTER ( WHERE cond ) ]
您也可以使用 OVER
子句,將此函式叫用為視窗函式。
參數
expr
:布林運算式。cond
:選擇性布林運算式,篩選用於匯總的資料列。
返回
布林值。
例子
> SELECT bool_and(col) FROM VALUES (true), (true), (true) AS tab(col);
true
> SELECT bool_and(col) FROM VALUES (NULL), (true), (true) AS tab(col);
true
> SELECT bool_and(col) FROM VALUES (true), (false), (true) AS tab(col);
false