Jump to content


Photo

MySQL Order By?


  • Please log in to reply
3 replies to this topic

#1 Ephialtes

Ephialtes
  • Members
  • Pip
  • Newbie
  • 5 posts

Posted 23 September 2005 - 12:31 PM

Basically, how come when i do an ordinary order by, using ORDER BY permission DESC and i have 10 entries, it goes like so:

9
8
7
6
5
4
3
2
1
10

How can i get it to put the 10 on the top? Is MySQL just stupid about counting?

#2 perchance

perchance
  • Members
  • Pip
  • Newbie
  • 1 posts

Posted 23 September 2005 - 12:35 PM

put a 0 in front of your numbers:
10
09
08
07
06
05
04
03
02
01


#3 Ephialtes

Ephialtes
  • Members
  • Pip
  • Newbie
  • 5 posts

Posted 23 September 2005 - 03:35 PM

Firstly, sorry for posting in the wrong area, i keep doing it by mistake, and secondly, that would muck up my system. Is there no other way of doing it?

#4 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 23 September 2005 - 06:42 PM

How is your field defined? If is it a character string, that how numbers are sorted when they are treated as text. Define it as an int and it should sort fine.

Ken




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users