Skip to main content

BIT_AND

Categories: Bitwise, Aggregate

BIT_AND

Returns the bitwise AND of non-NULL input values.

Syntax

BIT_AND(expression int) → int

  • expression: An expression that evaluates to a data type that can be cast as an integer.

Examples

BIT_AND example
SELECT BIT_AND(passenger_count)
FROM Samples."samples.dremio.com"."NYC-taxi-trips"
-- 0
BIT_AND example
SELECT total_amount, 
BIT_AND(passenger_count)
FROM Samples."samples.dremio.com"."NYC-taxi-trips"
GROUP BY total_amount
-- total_amount, EXPR$1
-- 21.5, 0
-- 19.1, 0

Usage Notes

If no rows match, returns a value with all bits set to 1. NULL values have no effect on the result unless all results are NULL, which is treated as no match.