比较Access SQL查询中的日期

时间:2023-01-14 15:42:46

I'm having trouble with Access sql query. Im new to this so bieng a rookie its difficult to figure out the syntax. below is my query.

我在使用Access sql查询时遇到问题。我是新手,所以bieng一个新手很难弄清楚语法。下面是我的查询。

SELECT *
FROM BookingMaster where JourneyDate = #01/08/2012#;

below is the respective table data:

以下是各自的表格数据:

BookingID   BookingDate JourneyDate CustomerName    TelephoneNo Address
5             01-08-2012       01-08-2012        roshan    78889      hjgj  

the above query listed returns 0 results even though data exist for 01/08/2012 journey date.

列出的上述查询返回0结果,即使数据存在于01/08/2012旅程日期。

Can anyone please help me out.

任何人都可以帮助我。

2 个解决方案

#1


14  

Unless you are working in a US locale, it is best to use a year, month, day format for dates:

除非您在美国语言环境中工作,否则最好使用年,月,日格式表示日期:

SELECT *
FROM BookingMaster where JourneyDate = #2012/08/01#;

#2


2  

try this..

尝试这个..

SELECT * FROM BookingMaster where (JourneyDate >= #01/08/2012#) and (JourneyDate < #01/09/2012#);

#1


14  

Unless you are working in a US locale, it is best to use a year, month, day format for dates:

除非您在美国语言环境中工作,否则最好使用年,月,日格式表示日期:

SELECT *
FROM BookingMaster where JourneyDate = #2012/08/01#;

#2


2  

try this..

尝试这个..

SELECT * FROM BookingMaster where (JourneyDate >= #01/08/2012#) and (JourneyDate < #01/09/2012#);