I have a query that has the following where statement: o.date>= DATEADD(YEAR, - 1, DATEADD(MONTH, @month - 1, DATEADD(YEAR, @Year - 1900, 0))) AND o.date< DATEADD(MONTH, @month, DATEADD(YEAR, @Year - 1900, 0)) AND o.date>=dateadd(month,datediff(month,0,getdate())-12,0) AND o.date<dateadd(month,datediff(month,0,getdate())+1,0)
The purpose of this is to pull 1 years worth of data from the current @month and @year supplied. It's worked great, but now that January, 2011 exists as a date everytime this query is pulled it ends up taking all the january figures for 2010 and listing them as January 2011.I'm not sure how to make this happen.Craig Greenwood