Can anyone explain why this query : SELECT p.id, p.prop_thumb_main, p.prop_address, ps.property_status FROM properties p, properties_status ps WHERE (prop_address LIKE '%Hol%' OR prop_address2 LIKE '%Hol%' OR prop_postcode LIKE '%Hol%') AND ps.property_id = p.id Code (markup): Would give only 1 result (Correctly) and this query : SELECT p.id, p.prop_thumb_main, p.prop_address, ps.property_status FROM properties p, properties_status ps WHERE prop_address LIKE '%Hol%' OR prop_address2 LIKE '%Hol%' OR prop_postcode LIKE '%Hol%' AND ps.property_id = p.id Code (markup): gives 2 duplicate results? (incorrectly) The only difference is the parenthesis around the patterning matching queries.
You gave the answer yourself Result is different because of paranthesis. In the second query "AND ps.property_id = p.id" this becomes useless because the other parts uses "or". If one equation matches then whole query returns true because you are using "OR" Just like mathemetic.