该部分between '2009-08-23' and '2009-08-23'
总是错误的,因为缺少更好的描述,这是零时间的范围.
如果您想要在2009-08-23完全发生项目,请选择between '2009-08-23' and '2009-08-24'
从23日午夜到24日午夜的项目.
以下是此操作的示例:
sqlite> CREATE TABLE t (d DATETIME); sqlite> SELECT DATETIME('now'); 2009-08-24 02:32:20 sqlite> INSERT INTO t VALUES (datetime('now')); sqlite> SELECT * FROM t; 2009-08-24 02:33:42 sqlite> SELECT * FROM t where d BETWEEN '2009-08-24' and '2009-08-24'; sqlite> SELECT * FROM t where d BETWEEN '2009-08-24' and '2009-08-25'; 2009-08-24 02:33:42