Skip to main content

SQLite Bitwise Search

SQLite Navigator

How can I perform a bit search with a SQLite query?

SQL

In this example, we will search for records that have an extra_flags with a bit set for 1 and 2. Generally a numeric field storing bits will allow for up to 32 flags that can be turned on or off (doubling in value, 1, 2, 4, 8, 16, 32, 64, 128, etc.).

select * from object where extra_flags & 1 or extra_flags & 2
Last Modified: 07/06/2023