Alex Rivera | Logout

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

Asked 2009-05-08T12:34:31.183
33

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?

Edit
Report

1 Answer

7

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

answered 2009-05-08T12:38:10.003

Your Answer