A
A
Art. Ku.2015-12-30 19:38:43
SQL
Art. Ku., 2015-12-30 19:38:43

Why is a date that has not yet arrived (2115-12-30 19:58:20) when ORDER BY does not display the date DESC first?

Under certain conditions, I write the date NOW() + INTERVAL 100 YEAR so that the string is always the first (and so that it is convenient to return it to the normal form str_replace-uv 21 by 20).
But why is the date that has not yet arrived (2115-12-30 19:58:20) when ORDER BY does not display the date DESC first? Broke his head.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Saboteur, 2015-12-30
@saboteur_kiev

Specify the version and brand of SQL, how exactly is the date stored - as a timestamp or just a string?
У timestamp, может быть проблема переполнения

N
nozzy, 2015-12-30
@nozzy

Храни 2115-12-30 как 21151230.

A
Art. Ku., 2015-12-30
@kukaew

ORDER BY date_add >= NOW() DESC, id DESC - в моём случае так заработала, насколько это применимо и насколько костыль? Я не особо разумею в SQL..

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question