Any date Last Year

  • Thread starter Thread starter Tara
  • Start date Start date
T

Tara

I need to create a query that will return any date from the previous calendar
year. So, if I were to run the query today, it would return all records that
had any date in 2007. If I were to run it next year, it would return all
records that had any date in 2008.

Any help is appreciated!
 
mscertified said:
WHERE DatePart('yyyy',FieldDate) = DatePart('yyyy',Date())-1

-Dorian

One should never apply criteria to an expression unless you absolutely have to.
Much more efficient (if FieldDate is indexed) would be...

WHERE FieldDate >= DateSerial(Year(Date())-1, 1, 1)
AND FieldDate < DateSerial(Year(Date()), 1,1)
 
Back
Top