Solved

MySQL: Order by longest

Posted on 2011-03-01
2
319 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
Comment Utility
Select * from yourtable
order by len(column) desc

not sure about mysql,
try
0
 
LVL 40

Accepted Solution

by:
Sharath earned 500 total points
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Loading csv or delimited data files to MySQL database is a very common task frequently questioned about and almost every time LOAD DATA INFILE comes to the rescue. Here we will try to understand some of the very common scenarios for loading data …
Introduction In this article, I will by showing a nice little trick for MySQL similar to that of my previous EE Article for SQLite (http://www.sqlite.org/), A SQLite Tidbit: Quick Numbers Table Generation (http://www.experts-exchange.com/A_3570.htm…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now