Q
Q
Qeinzo2021-11-16 10:52:14
SQL
Qeinzo, 2021-11-16 10:52:14

How correct is this request?

It is necessary to receive applications in a certain interval that correspond to certain statuses. The request runs fine, but I want to know if it's correct to write code like this.

WHERE Datetime BETWEEN '20211105' AND '20211109' 
AND Status = ('Новый') OR Status = ('В работе') OR Status = ('Доработка')

That is, I made a selection by dates and three statuses (New, In progress, Finalization).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Ronald McDonald, 2021-11-16
@Qeinzo

Instead of OR OR OR, you can use the IN operand.
And everything after AND must be enclosed in brackets, because now you may return incorrect answers.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question