开发者

SQL Server Group By Bitwise Or? [duplicate]

开发者 https://www.devze.com 2023-02-11 15:59 出处:网络
This question already has answers here: Closed 11 years ago. 开发者_开发问答 Possible Duplicates:
This question already has answers here: Closed 11 years ago.
开发者_开发问答

Possible Duplicates:

Aggregate bitwise-OR in a subquery

Update column to be different aggregate values

Let's say I have a table with the following records.

Role | AuthorizationNum

1      11
2      12
1      16
2      11

What I want to do is group by Role, the OR (BIT OR using |) AuthorizationNum. So my select should be 2 records.

Role | AuthorizationNum

1      27
2      15

Because...

11 | 16 = 27

11 | 12 = 15


By default mysql supports this but not sql server. But you can get around it using this: Update column to be different aggregate values

0

精彩评论

暂无评论...
验证码 换一张
取 消