Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jan 2006
    Location
    Finland, Hollola
    Posts
    285
    Thanks
    8
    Thanked 0 Times in 0 Posts

    How to ORDER BY DESC properly. It makes 150 before 50 if ASC order!?

    Hi,

    I have this list:
    50
    150
    200
    250
    300
    350
    400
    450
    500

    If I order it by ASC order then mysql results this:
    150
    200
    250
    300
    350
    400
    450
    50
    500

    What the hell ?? How do I order it properly??

    Thanks
    PHP 5 & MySQL 5 (Y)

  • #2
    Regular Coder
    Join Date
    Jun 2005
    Posts
    804
    Thanks
    0
    Thanked 0 Times in 0 Posts
    What type is your column?

  • #3
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    Location
    St. Catharines, Ontario Canada
    Posts
    2,634
    Thanks
    4
    Thanked 148 Times in 139 Posts
    It is either VARCHAR or CHAR type.

    If you are storing numeric data then choose the correct column type. Switch it to INT and it will sort fine.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •