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

50 lines
579 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/groupbitxor
2022-04-10 23:08:18 +00:00
sidebar_position: 127
2021-02-02 12:00:41 +00:00
---
# groupBitXor {#groupbitxor}
2021-02-05 15:50:14 +00:00
对于数字序列按位应用 `XOR`
**语法**
2021-02-02 12:00:41 +00:00
``` sql
groupBitXor(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 groupBitXor(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
01101000 = 104
```