Simple MySql conditional SELECT Query Problem with BOOLEAN
I've got a pretty simple issue here which I can't get to work.
SELECT * FROM pto_products WHERE blacklist IS NULL AND pzn LIKE '%$term%' OR name LIKE '%$term%'
Columns: blacklist is a MySql BOOL Field, TINYINT If the Record is blacklisted the value is set to 1 otherwise NULL
pzn is the Index and
INT name VARCHAR(255)
The Issue I have is that I allways receive all records includ开发者_C百科ing the blacklisted ones when I run this query. Does anyone know how I maybe need to group the conditions to achieve the needed result so the blacklisted records are excluded?
Thanks in advance!
SELECT * FROM pto_products WHERE blacklist IS NULL AND (pzn LIKE '%$term%' OR name LIKE '%$term%')
精彩评论