Sometimes you have to store numbers in text format. This is not a good practice, but sometimes there is no other option.

When you perform an “order by” this field,you can get something like this:

1
2
3
4
5
6
7
8
1
10
11
111
12
2
20
3




The trick is to add a zero to you field, on the “order by” clause.

1
select field from table order by field+0 asc

That’s it. As simple as this :)