postgresql - How to decode bit mask in sql -
for example 10 = 2+8 = 2^1 + 2^3
in query, how can select when want code contains 2^1 or 2^3?
you can try:
where (10 & (1 << 1) ) > 0 or (10 & (1 << 3)) > 0 or, single operator:
where 10 & ( (1 << 1) | (1 << 3) ) > 0
Comments
Post a Comment