title: MySQL query WHERE and AND on multiple rows
body: <p>Hi i have question about a MySQL query.</p>
  
  <p>I have the following table:</p>
  
  <pre><code>              product_properties             &lt;-- table name
  +------------------------------------------+    
  |  id  |  property  |  value  | productid  | &lt;-- field names
  +------------------------------------------+
  |   1  |  example   |    230  |         3  | +-- rows
  |   2  |  power     |    110  |         3  | |
  |   3  |  voltage   |    1.2  |         4  | |
  |   4  |  example   |    240  |         4  | |
  |   5  |  example   |    320  |         6  | |
  |   6  |  power     |    100  |         4  | |
  |   7  |  power     |    110  |         6  | +
  +------------------------------------------+
  </code></pre>
  
  <p>I want to create a filter query. For example:</p>
  
  <p>want to see all the products with 'example' that match with '230'. This will return one item, is i use:</p>
  
  <pre><code>SELECT * FROM product_properties WHERE property='example' AND value='230';
  </code></pre>
  
  <p>that was easy, but now i want to show all the products with 'example' that match with '230' and 'power' that match with '110'.</p>
  
  <p>i tried the following:</p>
  
  <pre><code>SELECT * FROM product_properties WHERE property='example' AND value='230' AND property='power' AND value='110';
  
  SELECT * FROM product_properties WHERE property='example' AND value='230' OR property='power' AND value='110';
  </code></pre>
  
  <p>problem with the first query is, it will return empty, i get that.
  problem with the second query is, that it is returning also the products with property 'example 230,240,320'.</p>
  
  <p>my question is what is the best way to use on this or shouldn't i create a dynamic product properties table?</p>