为什么不包括2005-11-30的值?

游戏Lan 2005-12-14 10:38:52
select 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的数据?
为什么?如何解决?


posttime 用的日期类型 设默认值为NOW()
数据库中有2005-11-1 到2005-12-12的所有记录(每天都有记录)
但查2005-11-1 到2005-11-30 的记录,惟独少2005-11-30 这一天
...全文
200 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
funsuzhou 2005-12-14
  • 打赏
  • 举报
回复
select thread_title,
threadID
from JB_thread
where
postuserid=428
and posttime> #2005-10-31#
and posttime< #2005-12-01#
funsuzhou 2005-12-14
  • 打赏
  • 举报
回复
select thread_title,threadID from JB_thread where postuserid=428 and (posttime BETWEEN #2005-11-01# and #2005-11-30#)

这句里面的#2005-11-30#
系统自动将它理解为
2005-11-30 00:00:00.000

所以<=2005-11-30 00:00:00.000 自然就没有2005年11月30日的数据了。
liujx_1999 2005-12-14
  • 打赏
  • 举报
回复
select thread_title,threadID from JB_thread where postuserid=428
and convert(varchar(8),posttime,120) >= #2005-11-01#
and convert(varchar(8),posttime,120)< #2005-12-1#
zoubsky 2005-12-14
  • 打赏
  • 举报
回复
同意上面几位的观点,把时间改一下,,
samchoy 2005-12-14
  • 打赏
  • 举报
回复
对,应该是时间部份造成的

select thread_title,threadID from JB_thread where postuserid=428
and posttime >= #2005-11-01#
and posttime < #2005-12-1#
$扫地僧$ 2005-12-14
  • 打赏
  • 举报
回复
select thread_title,threadID from JB_thread where postuserid=428 and (posttime BETWEEN #2005-11-01# and #2005-12-1#)
子陌红尘 2005-12-14
  • 打赏
  • 举报
回复
2005-11-30 = 2005-11-30 00:00:00

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#)

34,590

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧