title: MySQL WHERE LIKE AND OR
body: <p>I have a database app I'm working on for car products.</p>
  
  <p>I want the returned products results to match the conditions of:</p>
  
  <ul>
  <li>The 'MAKE' MUST match</li>
  <li>The 'CATEGORY' MUST match</li>
  <li>But when it gets to the 'OPTIONS', It can be either or all. I want it to return products that have either one or all of the options selected</li>
  </ul>
  
  <p>I am using:</p>
  
  <pre><code>SELECT *
  FROM `PRODUCTS`
  WHERE `MAKE` LIKE '%CHEV%'
  AND `CATEGORY` LIKE '%BUMPERS%'
  AND `OPTIONS` LIKE '%TOW HOOKS%'
  OR `OPTIONS` LIKE '%LIGHT MOUNT HOLES%'
  </code></pre>
  
  <p>When I use this it works but it is producing results from different MAKES as well. So it is returning products from lets say FORD as well... I don't want that.</p>
  
  <p>I want the MAKE and CATEGORY to be strict (they must match) but the OPTIONS can be one or both - or maybe even three or four different options - but at least one option must match.</p>
  
  <p>The <code>OPTIONS</code> filed is a string separated by pipe characters i.e. <code>LIGHT MOUNT HOLES|TOW HOOKS|FOUR DOOR</code>, and I don't want to change this.</p>
  
  <p>If I use the above query with just one OPTION in the search:</p>
  
  <pre><code> AND `OPTIONS` LIKE '%TOW HOOKS%'" or just "AND `OPTIONS` LIKE '%LIGHT MOUNT HOLES%'
  </code></pre>
  
  <p>... it works perfectly.  However, if I try to search for multiple OPTIONS, it starts bringing back products from different MAKES.</p>
  
  <p>I have also tried:</p>
  
  <pre><code>SELECT *
  FROM `PRODUCTS`
  WHERE `MAKE` LIKE '%CHEV%'
  AND `CATEGORY` LIKE '%BUMPERS%'
  OR `OPTIONS` LIKE '%TOW HOOKS%'
  OR `OPTIONS` LIKE '%LIGHT MOUNT HOLES%'
  </code></pre>
  
  <p>And have the same problem of multiple MAKES showing up.</p>