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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting by the year

Status
Not open for further replies.

BlastRadius

Programmer
Nov 13, 2001
38
0
0
CA
I have an events page which displays the events by month. Currently I have an extra non-essetial field to hold the name of the month just for select the month fields. Problem is now I need to create another field like this for the year so that the events from last year don't show up. All this seem to be a very poor way of doing it. I am sure there is a way in the sql statement to check a date field and compare it form just the month or just the year, etc. Can any one give me an example of the code I need to use to this. (using access db)
Thanks
 
Use the functions month/year on the dateTime column.

Code:
select * 
  from t 
 where month(dateC) = 4 
   and year(dateC) = 1956
[/kod]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top