Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2003
    Posts
    12

    Unanswered: Returning results order by string length.

    Hello,

    I need some help to return results form a MySQL database in the order of the size of the string. Such as:

    "Hello, this is one string"
    "Hey, this is the next"
    "Another string"

    I would like them to be returned in that order also.
    The field they are stored in is called words

    I have searched the MySQL online manual but with now luck. Have found the lenght function but have not had any luck.

    Thanks for your help,
    Jeremy Ross

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    jeremy, you were so close!

    select thestring
    from thetable
    order by length(thestring) desc


    rudy
    http://r937.com/

  3. #3
    Join Date
    Feb 2003
    Posts
    12
    Thanks for the quick reply! And its working great!

    Thanks,

Posting Permissions

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