title: Sql SELECT TOP 1
body: <p>I'm getting weird results from a table I'm selecting from. Consider the following table:</p>
  
  <pre><code>USERID    TICKETSASSIGNED
  
  1         0  
  100       0  
  101       0  
  102       0  
  103       0  
  </code></pre>
  
  <p>Now, if I have the following sql as in:</p>
  
  <pre><code>SELECT TOP 1 USERID  
    FROM TABLEX  
    ORDER BY TICKETSASSIGNED
  </code></pre>
  
  <p>The result I would expect to get is "1" but most all the time I'm getting "100", the second record. Since <code>TICKETSASSIGNED</code> values are all "0", it randomly picks which one it thinks is TOP 1 since this is the field I'm ordering on. To get the correct value of "1" in this case, I had to also order on <code>USERID</code>. </p>
  
  <p>Any ideas?</p>