Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.
Returns the bit-wise OR of the specified expression for each group of rows.
BIT_OR( 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 any row has a 1 in the bit position, this function
returns 1; otherwise, it returns 0.
The following example generates four rows containing a CHAR column, then converts the values to VARBIT.
SELECT BIT_OR( CAST(row_value AS VARBIT) )
The result 0111 is determined as follows:
A bitwise OR is performed between row 1 (0001) and row 2 (0111), resulting in 0111.
A bitwise OR is performed between the result from the previous comparison (0111) and row 3 (0100), resulting in 0111.
A bitwise OR is performed between the result from the previous comparison (0111) and row 4 (0011), resulting in 0111.