mysqlselectbit

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


Hi I am using hibernate and Mysql. I have a class with a boolean attribute called 'active'.

The generated database table has the BIT data type. So far so good. I want to query this value but I don't know how to do it. I've tried

 SELECT * from table where active = 1

doesn't work, neither the following

 SELECT * from table where active = true

I didn't find anything neither in the reference manual nor at Stackoveflow.

Any hint?


Solution

  • SELECT * FROM table WHERE active = (1)