我有两个使用 between 子句生成日期范围的查询,其中日期通过 VB.net 程序传入:
select
w.plate,
Description,
Date_in,
time_in,
Date_out,
Time_out,
Date_out-Date_in as "Days on Site",
Time_out-Time_in as "Duration on Site (Hrs)"
from tbl_stay S
inner join tblwhitelist W
on S.plate=W.plate
where Date_in between "1/06/2013" and "25/09/2013"
和
select
Plate,
Date_in,
Time_in,
Date_out,
Time_out,
Date_out-Date_in as "Days on site",
Time_out-Time_in as "Duration on site (Hrs)"
from tbl_stay
where plate not in (Select plate from tblwhitelist)
and date_in between "1/07/2013" and "1/08/2013"
为了进行测试,我有一个数据块,其输入和输出的日期均为“25/07/2013”。这些查询似乎只在当月的日期大于数据中提到的日期时才会产生结果 (25)
例如:上述查询中提到的日期:
Date_in between "1/06/2013" and "25/09/2013"
但是会产生结果
date_in between "1/07/2013" and "1/08/2013"
将不会。即使测试数据中包含的日期 (25/07/2013) 在这两个范围内。
我完全被难住了。这里可能发生了什么?任何援助将不胜感激