BOOL_AND() GROUP BY ...

All functions > GROUP BY > BOOL_AND() GROUP BY ...

Returns TRUE if all values in the group are true.

Syntax

Diagram(
  Sequence(
    Terminal("BOOL_AND"),
    Terminal("("),
    NonTerminal("expr"),
    Terminal(")"),
    Choice(0, Skip(),
      Sequence(
        Terminal("FILTER"),
        Terminal("("),
        Terminal("WHERE"),
        NonTerminal("condition"),
        Terminal(")")
      )
    ),
    Choice(0, Skip(),
      Sequence(
        Terminal("GROUP BY"),
        OneOrMore(NonTerminal("feature"), Terminal(","))
      )
    )
  )
)
ParameterTypeRequiredDescription
exprBOOLEANYesThe boolean expression to evaluate
conditionBOOLEANNoThe condition to filter the values before aggregation
featureFEATURENoThe features to group by (many features are supported)

Notes

  • Logical AND aggregation across all values in the group
  • Returns FALSE if any value is FALSE
  • Returns TRUE if all values are TRUE
  • NULL values are ignored in the calculation
  • Returns TRUE for empty groups (vacuous truth)
  • Can be used with WHERE clause to filter before aggregation
  • Can be used with GROUP BY clause for grouped aggregation

Examples

FeatureQL
SELECT
    f1 := ZIP(ARRAY[TRUE, FALSE, TRUE] AS value).TRANSFORM(SELECT BOOL_AND(value)).UNWRAP_ONE(),  -- AND of values
    f2 := ZIP(ARRAY[TRUE, TRUE, TRUE] AS value).TRANSFORM(SELECT BOOL_AND(value)).UNWRAP_ONE()  -- AND of values
;
Result
f1 BOOLEANf2 BOOLEAN
FALSETRUE

Last update at: 2026/03/03 16:47:38
Last updated: 2026-03-03 16:48:19