title: MYSQL- sorting varchar column includes number and char
body: <p>id column have these values: 2,10,X,Y,D,G</p>
  
  <p>I want to sort like this: 2,10,D,G,X,Y</p>
  
  <p>I tried many solutions, and results are here</p>
  
  <p><a href="http://sqlfiddle.com/#!2/846ed/1" rel="nofollow">http://sqlfiddle.com/#!2/846ed/1</a></p>
  
  <ol>
  <li><p>order by id*1;</p>
  
  <p>sorted results:G X Y D 2 10</p></li>
  <li><p>order by LPAD(id, 20, '0');</p>
  
  <p>sorted results:2 D G X Y 10</p></li>
  <li><p>order by  CASE WHEN id REGEXP '^[0-9]+$' THEN id*1 else 999999 END;</p>
  
  <p>sorted results:2 10 G X Y D</p></li>
  </ol>