Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
579 views
in Technique[技术] by (71.8m points)

select - 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?

Thanks in advance!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
SELECT * FROM table WHERE active = (1)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...