Home > database > Problem of SQL date/time - less than or equal to a time when there is no return expected results
Problem of SQL date/time - less than or equal to a time when there is no return expected results
Time:12-09
select * from table WHERE 1=1 AND the CONVERT (DATETIME, [Date]) & gt; ='2020-12-01'AND the CONVERT (DATETIME, [Date]) & lt;='2020-12-08'
I expected results to return contains' 2020-12-01 'and' 2020-12-08 ', include all the results (PS: the start time and end time not sure, can't use * days ago that kind of writing; Old code, try not to suggest modify the deadline for '2020-12-09') Local execution results are as follows:
Have bosses can know how to write back in '2020-12-08' results at the same time
CodePudding user response:
BBS active low, oneself solved:
select * from table where 1=1 AND the CONVERT (DATETIME, [Date]) & gt; ='2020-12-01'AND (the CONVERT (DATETIME, [Date]) & lt; (select DATEADD (day, 1, '2020-12-08')))