Solved

MySQL: Order by longest

Posted on 2011-03-01
2
329 Views
Last Modified: 2012-05-11
Using MySQL, how can I order results so that items with the most number of characters in their `Title` show up first?
0
Comment
Question by:hankknight
2 Comments
 
LVL 23

Expert Comment

by:Rajkumar Gs
ID: 35010250
Select * from yourtable
order by len(column) desc

not sure about mysql,
try
0
 
LVL 40

Accepted Solution

by:
Sharath earned 500 total points
ID: 35011145
Its LENGTH function.

Select * from yourtable
order by length(column) desc

or you can try CHAR_LENGTH or CHARACTER_LENGTH functions also instead of LENGTH.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of articles have been written on splitting mysqldump and grabbing the required tables. A long while back, when Shlomi (http://code.openark.org/blog/mysql/on-restoring-a-single-table-from-mysqldump) had suggested a “sed” way, I actually shell …
Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikipedia.org/wiki/PHP  Very powerful.  But a…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question