Answer the question
In order to leave comments, you need to log in
Why doesn't MYSQL double sort work?
Query like (example):
SELECT * FROM
(SELECT * FROM `table` ORDER BY `date` DESC LIMIT 8) a
ORDER BY `price`
sorts by price only (2nd parameter `price` ) ignoring sorting by date (1 parameter date ). How to make it work. Rather, it works on one hosting on another only by the 2nd parameter sorting occurs. Hosters say the problem is in the request.
Answer the question
In order to leave comments, you need to log in
Because MySQL does not guarantee to preserve the order of the rows retrieved from the subquery.
SELECT *
FROM (
SELECT *
FROM `table`
ORDER BY `date` DESC
LIMIT 8
) AS `a`
ORDER BY `date` DESC, `price`
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question