Answer the question
In order to leave comments, you need to log in
Why doesn't MySQL sort by date correctly?
There is a table with orders.
And I need to get all orders from it by date in reverse order. I wrote this query:
SELECT id, DATE_FORMAT(date, "%d.%m.%Y") as date, status
FROM orders
ORDER BY date DESC
Answer the question
In order to leave comments, you need to log in
Because after DATE_FORMAT you are not sorting dates, just strings.
Try like this:ORDER BY orders.date DESC
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question