適用対象:
Databricks SQL
Databricks Runtime
true 内のすべての値がグループ内で true の場合は expr を返します。
この関数は、集計関数everyシノニムです。
構文
bool_and(expr) [FILTER ( WHERE cond ) ]
この関数は、 句を使用して OVERとして呼び出すこともできます。
引数
-
expr: BOOLEAN 式。 -
cond: 集計に使用される行をフィルター処理するブール式 (省略可能)。
戻り値
BOOLEAN。
例
> 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
> SELECT bool_and(col1) FILTER(WHERE col2 = 1)
FROM VALUES (true, 1), (false, 2), (true, 1) AS tab(col1, col2);
true