BIT_OR

Function Description

BIT_OR() is an aggregate function that calculates the bitwise or OR of all bits in a column.

Function Syntax

Text
> BIT_OR(expr)

Parameter definition

Parameters

Description

expr

Column of type UINT

Example

Text
> drop table if exists t1;
> CREATE TABLE t1 (id CHAR(1), number INT);
> INSERT INTO t1 VALUES
      ('a',111),('a',110),('a',100),
      ('a',000),('b',001),('b',011);

> select id, BIT_OR(number) FROM t1 GROUP BY id;
+----+----------------+
| id | bit_or(number) |
+----+----------------+
| a  | 111            |
| b  | 11             |
+----+----------------+
Last updated on