Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.
Returns the bit-wise XOR of the specified expression for each group of rows.
BIT_XOR( bit-expression )
The object to be aggregated. The expression can be a VARBIT array, a BINARY value, or an INTEGER (including all integer
variants such as BIT and TINYINT).
The same data type as the argument. For each bit position compared, if an odd number of rows have a 1 in the bit position,
return 1; otherwise, return 0.
The following example generates four rows containing a CHAR column, then converts the values to VARBIT:
SELECT BIT_XOR( CAST(row_value AS VARBIT) )
The result 0001 is determined as follows:
A bitwise exclusive OR (XOR) is performed between row 1 (0001) and row 2 (0111), resulting in 0110.
A bitwise XOR is performed between the result from the previous comparison (0110) and row 3 (0100), resulting in 0010.
A bitwise XOR is performed between the result from the previous comparison (0010) and row 4 (0011), resulting in 0001.