I am attempting to perform the following MySQL query SELECT * FROM listings WHERE keywords like '%user%' or org like '%user%' AND town like '%LON%' or country like '%LON%' or postcode like '%LON I have added the line breaks in the query for clarity. suppose i run a query (one that works unlike the one above) i want to perform such that it returns record #1 only and not #2 ID KEYWORDS ORG POSTOCE CITY COUNTY 1 user CCS group dwddwwd LONDON UK 2 Another CCS group xxxx LON UK 3 user Counter strike xxxx Aberdeen UK 4 Me Counter strike xxxx Aberdeen UK 5 me Counter strike xxxx Aberdeen UK How can i acheive this, whats my error in the above query?
Try to use brackets. I believe the query should be: SELECT * FROM listings WHERE (keywords like '%user%' or org like '%user%') AND (town like '%LON%' or country like '%LON%' or postcode like '%LON%) Code (markup):