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.
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);