Answer the question
In order to leave comments, you need to log in
How to sort alphabetically the data (in the presence of quotes)?
There is data in the MySQL database.
I want to sort alphabetically (name ASC). But those entries that have quotes at the beginning and at the end ("Expo"), they are sorted first, and should be sorted by the first letter.
How to solve the problem?
Answer the question
In order to leave comments, you need to log in
Please note that IceJOKER and Mikhail Toderashko 's solution will work VERY slowly on even a relatively small base.
This sort does not use indexes.
With each request, for each row, the value of the TRIM function will be calculated, and then also sorted.
The correct solution in my opinion is to update the name field so that there are no quotes in it.
If this is not possible, create a new field without quotes and sort by it.
ORDER BY TRIM(BOTH '"' FROM name);
stackoverflow.com/questions/1439965/sort-by-name-b...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question