Skip to content

BIT_XOR

Function Description

BIT_XOR() is an aggregate function that calculates the bitwise xOR of all bits in a column.

Function Syntax

> BIT_XOR(expr)

Parameter definition

Parameters Description
expr Column of type UINT

Example

> 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_xor(number) from t1 group by id;
+---------------------------------+
| id | bit_xor(number) |
+---------------------------------+
| a | 101 |
| b | 10 |
+---------------------------------+