开发者

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%')
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜