0

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 including 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!

1 Answer 1

4
SELECT * FROM pto_products WHERE blacklist IS NULL AND (pzn LIKE '%$term%' OR name LIKE '%$term%')
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.