For each operator (ie <
or >
) there must be a distinct right and left side.
When you write datedebut < 20181109 < datefin
it is parsed as datedebut < 20181109
and the result of that comparison is sent to the next operator.
You need to think differently when writing SQL than when writing mathematics. You can argument that both “languages” have parsers, but they are slightly different.
EDIT comment:
As I have been made aware in the comments, My original answer was not entirely correct, since that would ave given a parse error. The essence is correct: Your query is not being parsed as you expected.
As others have answered, if you want a more compact answer, you need to use the BETWEEN
keyword instead of the <
and >
operators.
1
solved SQL plages de dates [closed]