Question : MYSQL USING "OR" and "AND" in same Query but still specific

Greetings EE Family, I'm perform a such where the adtitle and the comment could contain any of the search terms, however, I still only want to return active entries (active='1')

The following query still returns inactive entries (active='0'). How do I use OR  and still limit to active=1'....Or should "OR" NOT be used here?

SELECT * FROM table1 WHERE (adtitle LIKE '%free%') OR (comments LIKE '%free%') OR (adtitle LIKE '%food%') OR (comments LIKE '%food%') AND active='1')

Let me know. Thanks

Answer : MYSQL USING "OR" and "AND" in same Query but still specific

Maybe this:
1:
SELECT * FROM table1 WHERE ((adtitle LIKE '%free%') OR (comments LIKE '%free%') OR (adtitle LIKE '%food%') OR (comments LIKE '%food%')) AND active='1';
Random Solutions  
 
programming4us programming4us