Answer the question
In order to leave comments, you need to log in
How to do correct sorting in MySQL?
There is a table of goods which has an article number field.
Example
a-1
a-2
a-11
b-1
letters-1
a-1
a-11
a-12
a-2
a-1
a-2
a-11
a-12
Answer the question
In order to leave comments, you need to log in
SELECT * FROM `table` ORDER BY SUBSTRING(`field`, 1, 1), LENGTH(`field`), `field`;
www.copterlabs.com/natural-sorting-in-mysql
I think this article should partially help, but it is not a panacea.
Yes, it only works partially. If I had a- everywhere, it would help.
And so first all the letters in Alvatit with numbers up to 10 go, and then the rest.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question