Hello gurus!
I am confused by the DATEDIFF and DATEADD options when it comes to spanning a year, or when months do not all have 31 days..
I wish to grab all dates in a 6 month range of full months, which span a year. For example, if the query is run from March 15th, 2012, the desired result would be to get all dates for Feb,2012 (the prior full month- since March is not a full month, no results for that one), Jan, 2012, Dec, 2011,Nov, 2011 OCT, 2011 and Sept 2011.
Can anyone help me to understand the correct way of doing this?
I am confused by the DATEDIFF and DATEADD options when it comes to spanning a year, or when months do not all have 31 days..
I wish to grab all dates in a 6 month range of full months, which span a year. For example, if the query is run from March 15th, 2012, the desired result would be to get all dates for Feb,2012 (the prior full month- since March is not a full month, no results for that one), Jan, 2012, Dec, 2011,Nov, 2011 OCT, 2011 and Sept 2011.
Can anyone help me to understand the correct way of doing this?