This is a discussion on order query results by field length? within the MySQL Database forums, part of the Database Forums category; Anyone know of an easy way to order results of a query by the length of one of the fields? ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
cronoklee@hotmail.com wrote:
> Anyone know of an easy way to order results of a query by the length of > one of the fields? > ie. the record with the longest text in the 'description' field is > returned first? Yes, you can put expressions into the ORDER BY clause: SELECT ... FROM ... ORDER BY LENGTH(description) DESC Regards, Bill K. |