2020-06-18 08:24:31 +00:00
|
|
|
|
---
|
2022-08-28 14:53:34 +00:00
|
|
|
|
slug: /en/sql-reference/aggregate-functions/reference/groupbitand
|
2022-04-09 13:29:05 +00:00
|
|
|
|
sidebar_position: 125
|
2020-06-18 08:24:31 +00:00
|
|
|
|
---
|
|
|
|
|
|
2022-06-02 10:55:18 +00:00
|
|
|
|
# groupBitAnd
|
2020-06-18 08:24:31 +00:00
|
|
|
|
|
2023-06-02 11:30:05 +00:00
|
|
|
|
Applies bit-wise `AND` for series of numbers.
|
2020-06-18 08:24:31 +00:00
|
|
|
|
|
|
|
|
|
``` sql
|
|
|
|
|
groupBitAnd(expr)
|
|
|
|
|
```
|
|
|
|
|
|
2021-02-15 21:33:53 +00:00
|
|
|
|
**Arguments**
|
2020-06-18 08:24:31 +00:00
|
|
|
|
|
2023-05-05 10:03:07 +00:00
|
|
|
|
`expr` – An expression that results in `UInt*` or `Int*` type.
|
2020-06-18 08:24:31 +00:00
|
|
|
|
|
|
|
|
|
**Return value**
|
|
|
|
|
|
2023-05-05 10:03:07 +00:00
|
|
|
|
Value of the `UInt*` or `Int*` type.
|
2020-06-18 08:24:31 +00:00
|
|
|
|
|
|
|
|
|
**Example**
|
|
|
|
|
|
|
|
|
|
Test data:
|
|
|
|
|
|
|
|
|
|
``` text
|
|
|
|
|
binary decimal
|
|
|
|
|
00101100 = 44
|
|
|
|
|
00011100 = 28
|
|
|
|
|
00001101 = 13
|
|
|
|
|
01010101 = 85
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Query:
|
|
|
|
|
|
|
|
|
|
``` sql
|
|
|
|
|
SELECT groupBitAnd(num) FROM t
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Where `num` is the column with the test data.
|
|
|
|
|
|
|
|
|
|
Result:
|
|
|
|
|
|
|
|
|
|
``` text
|
|
|
|
|
binary decimal
|
|
|
|
|
00000100 = 4
|
|
|
|
|
```
|