I have the following mySQL query to run on my database using PHP It basically pulls out all article titles with a certain category and subcategory from the 'articles' table to display on the page.
But I want to be able to select a row that meets the following criteria:
SELECT * FROM articles WHERE category = 'cars' AND subcat = 'events' ORDER BY id DESC
Category = cars
Subcategory = events OR tech
I have tried this:
But this also selects other rows with other categories.
SELECT * FROM articles WHERE category = 'cars' AND subcat = 'events' OR subcat = 'tech' ORDER BY id DESC
Can anyone point me in the right direction here?