Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Selecting records matching a partial date

Author  Topic 

AlexMann
Starting Member

4 Posts

Posted - 2006-06-20 : 11:13:38
Hi all,

I have a database with a field which contains a load of dates in this format 01/03/1998

What I want to do is select all the records from the database where the month of the date is what ever, this month or the month the customer selected etc.

I suspected it may be something like the following (which doesnt work)

sql = "SELECT * FROM avail_lowermill WHERE CH_Arrival.month = " & showmonth & " ORDER by CH_Arrival"

Can anyone suggest how I can do this?

The following is for MySQL but not for MS Access

select * from avail_lowermill WHERE datediff(mm,convert(datetime,CH_Arrival.month,103),getdate()) = 0

Thanks in advance

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2006-06-20 : 12:43:45
Something like:

sql = "SELECT * FROM avail_lowermill WHERE month(CH_Arrival.month) = " & showmonth & " ORDER by CH_Arrival"

Go to Top of Page
   

- Advertisement -