Home > database >  SQL query classification problem, consult! Time parameter is invalid
SQL query classification problem, consult! Time parameter is invalid

Time:09-19

In a data table query classification with the WHERE and the time range without effect
Classification statistical data within 14 days (time range to adjust)

Select dt=the convert (varchar (10), [ED_msgtime], 120),
Qty=count (1)
The from [AIC_Access_EventMessageData]
Where ED_msgtime BETWEEN '2020-02-25 00:00:01. 000' AND 'the 2020-03-10 00:00:01. 000'
AND ED_ioeventno='100024' OR ED_ioeventno='100026'
Group by the convert (varchar (10), [ED_msgtime], 120)
The order by the convert (varchar (10), [ED_msgtime], 120)


B: where is you have a problem? How to perform?

In addition, a data table with multiple fields need according to the conditions query that how to write things

Equivalent to A condition when A number of conditions when the number of B

CodePudding user response:

Because a OR

Should ED_msgtime BETWEEN '2020-02-25 00:00:01. 000' AND 'the 2020-03-10 00:00:01. 000'
AND (ED_ioeventno='100024' OR ED_ioeventno='100026')

CodePudding user response:

The where condition, to prioritise the and condition, and then execute the or

So there is the or, to give priority to put parentheses enclosed first,

This is the knowledge of basic grammar
  • Related