Click here to Skip to main content
15,897,704 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
select * from userinfo

WHERE
[LoadDate]>='2016/10/01' and [LoadDate]<='2016/10/03'

the result shows of the date
01/10/2016 to 02/10/2016

i cannot see the data of 03/10/2016

What I have tried:

select * from userinfo

WHERE
[LoadDate]>='2016/10/01' and [LoadDate]<='2016/10/03'

the result shows of the date
01/10/2016 to 02/10/2016

i cannot see the data of 03/10/2016
Posted
Updated 2-Oct-16 22:48pm

1 solution

That's because '2016/10/03' is not a "full date time" - so SQL will assume you mean "2016-10-03 00:00:00.0000" and work from that. Hence, items added after midnight last night don't meet your criteria and aren't returned. If you want todays items as well, use:
SQL
SELECT * FROM userinfo WHERE [LoadDate]>='2016/10/01' and [LoadDate]<'2016/10/04'
Or
SQL
SELECT * FROM userinfo WHERE [LoadDate] BETWEEN '2016/10/01' and '2016/10/04'
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900