PDA

View Full Version : can you use a boolean field within a table to evaluate a query?


ibnpaul
04-25-2006, 11:00 PM
Hi all,

One quick question. I want to build a query like this:

SELECT * FROM <table> WHERE <condition>

Where <condition> is a boolean field in the table being accessed. I assumed in the construction of the query that simply placing a boolean-type field in the query after WHERE would cause the MySQL engine to only return the rows where the field is TRUE. Please let me know if this is correct, and will work. Thanks a lot.

GJay
04-26-2006, 09:26 AM
Yeah, that will work, e.g:
SELECT name, price FROM products WHERE visible;

ibnpaul
04-27-2006, 07:36 PM
Thanks a lot!