我已经能够使用substring(colname, N, 1)
从字段中取出第N个字节,但此时似乎无法将结果视为二进制:
> select substring(colname, N, 1) from [...]
\
> select hex(substring(colname, N, 1)) from [...]
5C
> select hex(substring(colname, N, 1) & 0xff) from [...]
0
> select cast(substring(colname, N, 1) as unsigned integer) from [...]
0
与:相比:
> select cast(0x5c as binary);
\
> select hex(0x5c & 0xff);
5C
> select cast(0x5c as unsigned integer);
92
我最终想要的是:
> select [...] where substring(colname, N, 1) & 0b00100000 = 0b00100000;
答案 0 :(得分:1)
尝试类似的东西:
select ascii(substring(colname,N,1)) from [...]