Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to search for months in Access SQL

Status
Not open for further replies.

ColdFusionRook

Programmer
Jun 1, 2001
1
US
First I just want to start by saying I'm very much a rookie when it comes to queries so this may be a very simple question.

I'm trying to look for dates within a month in my query. I have a birthday field, birthday, in a table, ca_members, and i want to know what birthdays are in a certain month. Birthday is a date field. So basically what I'm saying is, how do I query the database to retreive the records whose birthdays are in july.

Thanks,

Eric

PS I can do this in Oracle or and MySQl, but just can't do it in Access
 
I do not know the other dbs syntax. In Ms. Access, there are several Functions for date manipulation. The most direct (in Ms. Access) wowuld probably be something similar to:

Where Month([BirthDay]) = selected Month

in the above, selected Month would be an integer between 1 and 12.




MichaelRed
redmsp@erols.com

There is never time to do it right but there is always time to do it over
 

Select * From table Where month(birthday)=month(date())

will seelect birthdays in current month. To speicify a particular month, such as July you would use the following query.

Select * From table Where month(birthday)=7 Terry
------------------------------------
Blessed is the man who, having nothing to say, abstains from giving us worthy evidence of the fact. -George Eliot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top