title: SQL UPDATE query fails with LIMIT 1 but works with LIMIT 2
body: <p>I have a strange problem with a query in my php script.</p>
  
  <p>I have a table with many thousand rows that ALL match the queries below, so I (wanted to) use LIMIT 1 to only update one of them.</p>
  
  <p>When I ran these queries in my script and via phpMyAdmin:</p>
  
  <p>Query 1 returns '1 rows affected':</p>
  
  <pre><code>UPDATE licenses SET license_refunded = 'no'
  WHERE license_status = 'available'
  ORDER BY license_id ASC
  LIMIT 1;
  </code></pre>
  
  <p>Query 2 returns '0 rows affected':</p>
  
  <pre><code>UPDATE licenses SET license_refunded = 'no'
  WHERE license_status = 'available'
  AND license_years='1'
  ORDER BY license_id ASC
  LIMIT 1;
  </code></pre>
  
  <p>Query 3 returns '2 rows affected':</p>
  
  <pre><code>UPDATE licenses SET license_refunded = 'no'
  WHERE license_status = 'available'
  AND license_years='1'
  ORDER BY license_id ASC
  LIMIT 2;
  </code></pre>
  
  <p>As you can see, the only difference between Query 1 and Query 2 is the "AND license_years='1'", and the only difference between Query 2 and Query 3 is the LIMIT 1 and LIMIT 2.</p>
  
  <p>Can anyone shed some light on this, why is Query 2 not affecting 1 row?</p>
  
  <p>Query 2 does update 1 row (as it should) when being run via a mysql client (Linux terminal).</p>
  
  <p>Is this a php/mysql bug?</p>