Hello.
When sorting by date, sorting occurs in numbers, but months are displayed in the reverse order – November, October.
Here is a query:
select *, date_format (date, '% d% m% y') as `date` tor
Table
Where
Start
= ‘$ search’ andEnd
=
‘$ search1’ anddate
between
Curdate () and Curdate () + Interval 2
MONTH ORDER by DATE DESC “
What to fix it to be removed all right – days and months ascending?
Answer 1, Authority 100%
Desc – sorting from more to a smaller.
ASC – from smaller to more.
Answer 2, Authority 100%
In this example, I would have done so at the end:
Order by unix_timestamp (str_to_date (
date , '% y-% m-% d')) DESC
I note – % y-% M-% D
In this order, part of the date are located in the database.
and yes, it seems easier so. And more – date
like a reserved word in mysql
.