Syntax
BIT_XOR(expr)
Purpose
You can call this function to return the bitwise XOR of all bits in expr.
The result is a binary string or a number. This depends on the type of the argument value. When the argument value contains a binary string and the argument is not a hexadecimal, bit, or NULL literal, a binary string result is calculated. Otherwise, a numeric result is calculated. If necessary, the function converts the argument value to an unsigned 64-bit integer.
If no matching row is found, BIT_XOR() returns a neutral value whose all bits are set to 0. The neutral value has the same length as the argument value.
NULL values have no effect on the result unless all values are NULL. In this case, the result is a neutral value that has the same length as the argument value.
Examples
obclient> SELECT year,month,BIT_COUNT(BIT_XOR(1<<day)) AS days FROM tbl1 GROUP BY year,month;
+------+-------+------+
year month days
+------+-------+------+
2021 01 3
2021 02 1
+------+-------+------+
2 rows in set