title: MySQL query selecting max value
body: <p>I have this two tables:</p>
  
  <pre><code>product
  id | name
  1  |  A
  2  |  B
  
  history
  id_product | year | month | percent
  1          | 2014 |   2   |  0
  1          | 2014 |   3   |  20
  1          | 2014 |   4   |  60
  </code></pre>
  
  <p>How can I get the highest percent if the month is the the current month or a month before, for example:</p>
  
  <pre><code>SELECT * FROM history 
  WHERE id_product IN
       (SELECT id FROM product 
        WHERE id = 1) 
    AND ((year = 2014 AND month = 3) OR 
         (year = 2014 AND month = 2)) 
  ORDER BY year DESC, month DESC
  </code></pre>
  
  <p>This would output: 20 but it actually shows 0, it always gives me the month's before value...Any suggestions are welcomed...Thanks!!</p>