SQL Server group in a bitwise way?

Possible duplicates:
Aggregate bitwise OR in a subquery
Update a column for different aggregation values

Say I have a table with the following entries.

Role | AuthorizationNum

1      11
2      12
1      16
2      11

What I want to do is group by Role, OR (BIT OR using |) AuthorizationNum. Therefore, my choice should consist of 2 entries.

Role | AuthorizationNum

1      27
2      15

Because...

11 | 16 = 27

11 | 12 = 15

+3
source share
1 answer

By default, mysql supports this, but not sql server. But you can get around this using the following: Refresh the column for different aggregate values

0
source

Source: https://habr.com/ru/post/1792580/


All Articles