title: Sorting varchar field numerically in MySQL
body: <p>I have a field <code>number</code> of type <code>varchar</code>. Even though it is of type <code>varchar</code>, it stores integer values with optional leading zeros. A sort orders them lexicographically (<code>"42"</code> comes before <code>"9"</code>). How can I order by numeric values (<code>"9"</code> to come before <code>"42"</code>)?</p>
  
  <p>Currently I use the query:</p>
  
  <pre><code>SELECT * FROM table ORDER BY number ASC
  </code></pre>