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

select + date

Status
Not open for further replies.

vlitim

Programmer
Sep 2, 2000
393
GB
I have a date field in my dbase and in the select statement I want to check to make sure that the year part of it is = to the current year.

so something like:

select * from events where offDate <= yearNow

can someone please help me on this

cheers

Tim
 
select * from events where year(offdate) = year(getdate())

probably would not optimise to well, but would work fine if the table was small.

select * from events
where offdate between str(year(getdate()))+'-01-01' and
str(year(getdate()))+'-12-31 11:59:59'

should optimise just fine
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top