how to search between 2 dates and times in access?

眉间皱痕 提交于 2019-12-11 04:59:20

问题


i have in my access fields MyDate and myTime.

MyDate in format: 16/09/2010 00:00:00

MyTime in format: 16/09/2010 04:27:00

i need to search between date 01/01/2010 and time 12:50:00 - and - date 12/11/2010 time 01:34:00

which query i need to write ?

thank's in advance


回答1:


The delimiter in Access is hash (#). I hope that you are using a date-time fields, and not two separate fields (columns).

SELECT MyDate
FROM tbl
WHERE MyDate Between #2/5/2006 14:7:0# And #11/18/2006 17:28:15#

You will find additional notes here on date formats (ANSI, US) and concatenating date & time:

Error when inserting a record into MS Access MS Access 2007: date query



来源:https://stackoverflow.com/questions/3725177/how-to-search-between-2-dates-and-times-in-access

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!