oo0select thread_title,threadID from JB_thread where postuserid=428 and (posttime BETWEEN #2005-11-01# and #2005-11-30#)
posttime 是ACCESS时间类型字段 包含2005-11-30的数据
但查询结果并没有2005-11-30的数据?
为什么?如何解决?
...全文
596打赏收藏
为什么不包括2005-11-30的值?
oo0select thread_title,threadID from JB_thread where postuserid=428 and (posttime BETWEEN #2005-11-01# and #2005-11-30#) posttime 是ACCESS时间类型字段 包含2005-11-30的数据 但查询结果并没有2005-11-30的数据? 为什么?如何解决?
select thread_title,threadID from JB_thread where postuserid=428 and (posttime BETWEEN #2005-11-01# and #2005-11-30#)
来搜索值,那么 JET DB 会自动给你加上
select thread_title,threadID from JB_thread where postuserid=428 and (posttime BETWEEN #2005-11-01 00:00:00# and #2005-11-30 00:00:00#)
00:00:00 你想不要都不行。解决方法是
直接写 SQL 代码如下
select thread_title,threadID from JB_thread where postuserid=428 and (posttime BETWEEN #2005-11-01 00:00:00# and #2005-11-30 23:59:59#)
或者
select thread_title,threadID from JB_thread where postuserid=428 and format(posttime,"yyyy-mm-dd")>='2005-11-01' and format(posttime,"yyyy-mm-dd")<='2005-11-30'
注意, FORMAT 函数需要 ACCESS DRIVER 支持,如果你是 vb+JETDB 等方法开发,可能不支持。