title: SQL: Opencart Range Filter
body: <p>I have made a little extension to "Filter" module in opencart.
  But still have a small problem.</p>
  
  <p>My current SQL:</p>
  
  <pre><code>SELECT product.product_id FROM `oc_product` product
  LEFT JOIN `oc_product_attribute` attribute ON product.product_id = attribute.product_id
  WHERE 
  ((attribute.attribute_id = 13 (weight) AND `text` BETWEEN 1 AND 2) 
  OR (attribute.attribute_id = 12 (length) AND `text` BETWEEN 10 AND 12));
  </code></pre>
  
  <p>But this returns things between 1 and 2 (weight) along with between 10 and 12 (length). So for example, something weights 2kg gets returned and something that is 11cm long get returned. </p>
  
  <p>I want it to return something that would both, for example, weigh 2kg and be 11cm long.</p>
  
  <p>I have tried putting <code>AND</code> between conditions, but it doesn't return anything.</p>
  
  <p>Thank you</p>