I need to expand on a solution that I received here. I wanted to get the past 3 months of data from the current date with each month separate. For example:
(@MyDate>= DATEADD(month, DATEDIFF(month, 0, GETDATE()) - 2, 0)) AND (@MyDate< DATEADD(month, DATEDIFF(month, 0, GETDATE()) - 1, 0))
This would get data from 2 months ago. I'm now being tasked to get data from 2 months ago plus ytd at that point in time. So, November 2012 and January 2012 - November 2012. I need this to be dynamic as the months shift. Any suggestions?