我无法让日期范围在使用 SQLite3 Create And Populate Table 的查询中正常工作:
create table dates(myDate DATE);
insert into dates values('2012-10-1');
insert into dates values('2012-10-2');
insert into dates values('2012-10-3');
insert into dates values('2012-10-4');
insert into dates values('2012-10-5');
insert into dates values('2012-10-6');
insert into dates values('2012-10-7');
insert into dates values('2012-10-8');
insert into dates values('2012-10-9');
insert into dates values('2012-10-10');
询问:
select * from dates where myDate >= '2012-10-1' and myDate < '2012-10-31';
结果:
2012-10-1
2012-10-2
2012-10-3
2012-10-10
10-4 - 10-9 在哪里?
如果我在以下之间使用,我会得到相同的结果:
select * from dates where myDate BETWEEN '2012-10-1' AND '2012-10-30';
如果我将任一查询更改为使用“2012-11-1”作为结束日期,它们将正常工作。
任何帮助将不胜感激!