Answer the question
In order to leave comments, you need to log in
How to properly sort multiple ORDER BY DESC conditions?
SELECT * FROM `serial` ORDER BY `serial`.`season` DESC, `serial`.`episode` DESC LIMIT 10
Answer the question
In order to leave comments, you need to log in
Most likely, the field has a text type, not a numeric type, which is why it is sorted as text.
Use Explicit Conversion
ORDER BY ... CAST(`serial`.`episode` AS UNSIGNED) DESC
Of course, the index will not work with such sorting.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question