Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

MySQL: Order by longest

Posted on 2011-03-01
2
Medium Priority
?
340 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 41

Accepted Solution

by:
Sharath earned 2000 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read on. . .
In this article, I’ll talk about multi-threaded slave statistics printed in MySQL error log file.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month10 days, 18 hours left to enroll

886 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