Selecting based on bitflags
My MySQL database has a table where one column (field) is populated with 16bit numeric values (TINYINT). They are bit fields where each bit represents an independent condition.
Is there a way to select those rows (records) where a specific bit is set?
For example I want to select the "detail_field" from only those rows where bit 5 is high in the "bitflag_field' of the "the_table" table.
I don't beleive a statement like this is possible because the WHERE operators do not include a bitwise "AND":
SELECT detail_field FROM the_table WHERE bitflag_field & 32
The operators for WHERE and HAVING don't seem to permit bit testing.
Is there a way to select based on a bitwise comparison?
Regards,
Aza D. Oberman
Washington DC