BIT_AND Function

Description

An aggregate function. It performs AND operations in bits on every bit of expr. The return value is a BIGINT type. If there is no row that satisfies the expression, NULL is returned. 

Syntax

BIT_AND(expr)

Example

CREATE TABLE bit_tbl(id int);

INSERT INTO bit_tbl VALUES (1), (2), (3), (4), (5);

SELECT 1&3&5, BIT_AND(id) FROM bit_tbl WHERE id in(1,3,5);

                 1&3&5           bit_and(id)

============================================

                     1                     1