BIT_AND
Perform a bitwise AND operation. This function returns the result of performing a bitwise AND on all values in a given expression.
Syntax
BIT_AND(expr) [over_clause]Description
Returns the bitwise AND of all bits in expr. The calculation is performed with 64-bit (BIGINT) precision. It is an aggregate function, and so can be used with the GROUP BY clause.
If no rows match, BIT_AND will return a value with all bits set to 1. NULL values have no effect on the result unless all results are NULL, which is treated as no match.
BIT_AND can be used as a window function with the addition of the over_clause.
Examples
CREATE TABLE vals (x INT);
INSERT INTO vals VALUES(111),(110),(100);
SELECT BIT_AND(x), BIT_OR(x), BIT_XOR(x) FROM vals;
+------------+-----------+------------+
| BIT_AND(x) | BIT_OR(x) | BIT_XOR(x) |
+------------+-----------+------------+
| 100 | 111 | 101 |
+------------+-----------+------------+As an aggregate function:
No match:
See Also
This page is licensed: GPLv2, originally from fill_help_tables.sql
Last updated
Was this helpful?

