Date Comparison in SQL Access Query

I'm having problems with Access SQL query. I'm new to this, so bieng the rookie is hard to understand syntax. Below is my request.

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

The following are the relevant table data:

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

the above query returns 0 results, even if the data exists for the travel date 01/08/2012.

Can anybody help me.

+8
database ms-access ms-access-2007
source share
2 answers

If you work in the US locale, it is best to use the year, month, day format for dates:

 SELECT * FROM BookingMaster where JourneyDate = #2012/08/01#; 
+13
source share

try it.

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

All Articles