title: how to use left outer join with like/or like
body: <p>I'm creating a search function. My sql query uses <code>LIKE</code> and <code>OR LIKE</code> in the where clause. One of the fields in the table I'm searching in is called <code>quantity_types</code> where it stores only codes that corresponds to the values found in another table. So to retrieve the values from the other, I want to use a <code>Left Outer Join</code> in my query.</p>
  
  <p>Here's my sample code:</p>
  
  <pre><code>SELECT * FROM `pharmacy_items`
  LEFT OUTER JOIN pharmacy_quantity_types
  ON pharmacy_items.quantity_type = pharmacy_quantity_types.id
  AND 'pharmacy_items.name' LIKE '%query_here%'
  OR 'pharmacy_items.description' LIKE '%query_here%'
  </code></pre>
  
  <p>This query returns all the records in my <code>pharmacy_items</code> table instead of those records which are supposed to be returned with I'm not using a <code>LEFT OUTER JOIN</code>.</p>
  
  <p>How would I build my query such that the returned results are those that satisfies first the <code>WHERE</code> clause before the <code>LEFT OUTER JOIN</code></p>