List:General Discussion« Previous MessageNext Message »
From:Patrick Sullivan Date:March 20 2000 8:37pm
Subject:RE: MySql order by (length of string)
View as plain text  
Hey
This didn't work for 3.22. I had to do
select *, length(my_field) as fieldlen order by fieldlen;
But it does work now! Thanks for your help.
PAtrick

-----Original Message-----
From: Sergei Golubchik [mailto:serg@stripped]
Sent: Monday, March 20, 2000 11:36 AM
To: Patrick Sullivan
Cc: mysql@stripped; chris@stripped
Subject: Re: MySql order by (length of string)


On Mar 20, Patrick Sullivan wrote:
> Hello, all.
> I need to sort my results by the length (# of characters) of one of the
> fields I'm returning. Do I need to write a function to do this? Waht would
> it look like?
> Thanks very much.
>
> PAtrick Sullivan
>
That's in the manual.

SELECT ... ORDER BY LENGTH(your_field);

Regards,
SerG.

Thread
MySql order by (length of string)Patrick Sullivan20 Mar
  • Re: MySql order by (length of string)Sergei Golubchik20 Mar
    • RE: MySql order by (length of string)Patrick Sullivan20 Mar