you just need this i guessdeclare @date datetime set @date ='12/31/2011'SELECT MONTH([END]) as mth, YEAR([END]) as yr, COUNT(Task) AS DUE FROM xTask where [END]>= dateadd(mm,datediff(mm,0,@date)-2,0) and [END]< dateadd(mm,datediff(mm,0,@date)+1,0) and status <> 'c' group by MONTH([END]), YEAR([END]))
------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/