Mysql: How to query a column whose type is bit? Mysql: How to query a column whose type is bit? mysql mysql

Mysql: How to query a column whose type is bit?


SELECT * FROM table WHERE active = (1)


According to this page, BIT is a synonym for TINYINT(1) for versions before 5.0.3.

Have you tried these?

SELECT * from table where active = (1)SELECT * from table where active = 'true'SELECT * from table where active = b'1'

This blog entry suggests to avoid the BIT data type altogether.


To specify bit values, b'value' notation can be used.