I am using the following query to bring back data from the start of the year to the end of the last month.
The date is datetime field
where year(acd.startdatetime) = year(getdate()) and month(acd.startdatetime) <= Month(getdate()) - 1
I now need to a query to bring back the last full years data i.e. 2006 Jan 1st - Dec 31. This will then be run on the 1st of January every year to bring back the previous years data.
Can anybody help?