ClickHouse/docs/zh/sql-reference/aggregate-functions/reference/groupbitand.md

49 lines
507 B
Markdown
Raw Normal View History

2021-02-02 12:00:41 +00:00
---
toc_priority: 125
---
# groupBitAnd {#groupbitand}
2021-02-05 15:50:14 +00:00
对于数字序列按位应用 `AND`
**语法**
2021-02-02 12:00:41 +00:00
``` sql
groupBitAnd(expr)
```
2021-02-05 15:50:14 +00:00
**参数**
2021-02-02 12:00:41 +00:00
2021-02-05 15:50:14 +00:00
`expr` 结果为 `UInt*` 类型的表达式。
2021-02-02 12:00:41 +00:00
2021-02-05 15:50:14 +00:00
**返回值**
2021-02-02 12:00:41 +00:00
2021-02-05 15:50:14 +00:00
`UInt*` 类型的值。
2021-02-02 12:00:41 +00:00
2021-02-05 15:50:14 +00:00
**示例**
2021-02-02 12:00:41 +00:00
2021-02-05 15:50:14 +00:00
测试数据:
2021-02-02 12:00:41 +00:00
``` text
binary decimal
00101100 = 44
00011100 = 28
00001101 = 13
01010101 = 85
```
2021-02-05 15:50:14 +00:00
查询:
2021-02-02 12:00:41 +00:00
``` sql
SELECT groupBitAnd(num) FROM t
```
2021-02-05 15:50:14 +00:00
`num` 是包含测试数据的列。
2021-02-02 12:00:41 +00:00
2021-02-05 15:50:14 +00:00
结果:
2021-02-02 12:00:41 +00:00
``` text
binary decimal
00000100 = 4
```