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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

50 lines
577 B
Markdown
Raw Normal View History

2021-02-02 12:00:41 +00:00
---
2022-08-26 19:07:59 +00:00
slug: /zh/sql-reference/aggregate-functions/reference/groupbitand
2022-04-10 23:08:18 +00:00
sidebar_position: 125
2021-02-02 12:00:41 +00:00
---
# 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
```