跳转到主内容
跳转到主内容

groupBitAnd

groupBitAnd

自 v1.1 版本引入

对一系列数值执行按位与运算。

语法

groupBitAnd(expr)

别名: BIT_AND

参数

  • expr(U)Int* 类型的表达式。(U)Int*

返回值

返回 (U)Int* 类型的值。(U)Int*

示例

按位与示例

CREATE TABLE t (num UInt32) ENGINE = Memory;
INSERT INTO t VALUES (44), (28), (13), (85);

-- Test data:
-- binary     decimal
-- 00101100 = 44
-- 00011100 = 28
-- 00001101 = 13
-- 01010101 = 85

SELECT groupBitAnd(num) FROM t;
-- Result:
-- binary     decimal
-- 00000100 = 4

┌─groupBitAnd(num)─┐
│                4 │
└──────────────────┘