title: MySQL ORDER BY decimal value not working
body: <p>The SQL query with <code>order by</code> clause is not working properly.  </p>
  
  <pre><code>VALUES:
  5.0000   
  4.0000   
  4.5000  
  4.7500  
  4.0000  
  5.0000
  </code></pre>
  
  <p>Query:</p>
  
  <pre><code>SELECT  AVG(rating) as rating
  FROM review
  GROUP BY id
  ORDER BY CAST(`rating` as signed) DESC  
  </code></pre>
  
  <p>When I execute this query, the output is:  </p>
  
  <pre><code>5.0000  
  4.7500  
  4.5000  
  5.0000  
  4.0000  
  4.0000
  </code></pre>
  
  <p>My rating column is <code>int(10)</code>.</p>