我的列类型为Number
,此数字规则为
1,2 => 3
1,2,4 => 7
2,4 => 6
最后,我将保存结果,例如3,7,6。
这是二进制的总和。我可以在哪里检查包括2?谢谢你的帮助。
示例
| id | type | data |
|----|------|------|
| 1 | 2 | test |
| 2 | 3 | test2|
| 3 | 1 | test3|
| 4 | 6 | test4|
结果是我想要的。
| id | type | data |
|----|------|------|
| 1 | 2 | test |
| 2 | 3 | test2|
| 4 | 6 | test4|
sql ex
select * from test_table where type "include 2";
答案 0 :(得分:1)
我找到了目标的答案。我可以使用bitand
函数here。
select * from test_table where bitand(type, 2) = 2;