MySQL Order By Problem, Why is 1000 being seen as Smaller than 2?

Posted by Jack on Stack Overflow See other posts from Stack Overflow or by Jack
Published on 2010-04-05T15:41:13Z Indexed on 2010/04/05 15:43 UTC
Read the original article Hit count: 129

Filed under:

I have a strange problem,

I am trying to order the output of a set of records by a field called displayOrder. Now even though record A has a displayOrder of 2 and record B has a displayOrder of 1000, record B still shows up before record A. Here's my select statement:

SELECT * FROM items ORDER BY displayOrder ASC

It works fine until I have a record greater than 9, then 10, 11, 12, etc are seen as smaller than 2, 3, 4 because they start with the number 1. Any way to fox this?

© Stack Overflow or respective owner

Related posts about mysql