C
C
CityzenUNDEAD2020-09-29 15:29:25
SQL Server
CityzenUNDEAD, 2020-09-29 15:29:25

Is it correct to use BETWEEN to sort by date?

Is it correct to use BETWEEN to sort by dates?

WHERE UpdateDate BETWEEN '28.09.2020' AND '29.09.2020'

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Aksentiev, 2020-09-29
@Sanasol

Normal, only it's not sorting, but filtering.
And it is also desirable to enclose the entire between in brackets so that there is no confusion in the future when using several conditions.

C
ComodoHacker, 2020-09-29
@ComodoHacker

Not right. BETWEEN is used for selection.
For sorting, ORDER BY is used.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question