Access日期时间查询

Access日期时间条件查询
  如果字段的数据类型是Date/Time类型,使用普通的方式无法查询精确到时分秒的数据,解决方案如下:

精确到日期:
select * from user where userId = 26 and createTime > #2018/1/25#

精确到时分秒(错误方式):
select * from user where userId = 26 and createTime = #"2018/1/25 8:23:42"#

精确到时分秒(正确方式):
select * from user where userId = 26 and createTime = cdate("2018/1/25 8:23:42"); 

猜你喜欢

转载自blog.51cto.com/1197822/2314590