title: MySQL ORDER BY combined with LIMIT 1 returns empty result
body: <p>We do have an script that automatically inserts a hash value out of a pool into an article if it does meet certain conditions. The extension doing that was programmed several years ago and worked well so far.
  Now it stopped working and nobody knows why. After a long time of debugging I found the error in the SQL statement.</p>
  
  <p>The generated statement looked like this:</p>
  
  <pre><code>SELECT `hash` 
  FROM `table` 
  WHERE `is_used` =0
  ORDER BY `uid`
  LIMIT 1
  </code></pre>
  
  <p>If I just remove the "ORDER BY <code>uid</code>", it works again. I just would like to know why this happened out of the blue. The hoster said that there were no changes/updates made on the systems side and I checked all related files, none of those were changed within the last year.</p>
  
  <p>About the system.
  TYPO3 4.5.2
  PHP Version 5.3.8-1~dotdeb.1
  MySQL Version 5.1.57</p>
  
  <p>Thanks in advance</p>
  
  <p>Edit:
  Sorry for the confusion.
  With "stopped working" I meant that from one day to another no hashes were inserted into the articles.
  When I execute the statement with the ORDER BY, I'm getting one empty row as a result.
  The uid column does still exists. There were no changes to anything on the system, including the database and its tables.
  I've attached an image with the table structure and both query results on the right (well, it's not really attached, since I need more reputation to attach it).</p>
  
  <p>To clarify my question again: The query worked before and returned a hash. Now it only works when I remove the ORDER BY and I would like to know how this could happen, since I'm curious and it may help me with future errors.
  <a href="http://i.stack.imgur.com/Dpip4.png" rel="nofollow">http://i.stack.imgur.com/Dpip4.png</a></p>
  
  <p>P.S.: I've edited the table name, don't be scared ;)</p>