Syntax
BIT_XOR(expr)
Purpose
Returns the bitwise XOR of all bits in expr.
The result type depends on whether the function's parameters are evaluated as binary strings or numbers. When the parameter values are binary strings and not hexadecimal literals, bit literals, or NULL literals, binary string evaluation occurs. Otherwise, numeric computation occurs, with parameter values converted to unsigned 64-bit integers when necessary.
If no rows match, BIT_XOR() returns a neutral value with the same length as the parameter value (all bits set to 0).
Unless all values are NULL, NULL values do not affect the result. In this case, the result is a neutral value with the same length as the parameter 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
