Need help in writing the query to get the last month data as well as month to date data.
If today\'s date is Mar 23 2011, I need to retrieve the data from last month
Select Column1, Column2 From Table1 Where DateColumn <= GetDate() AND DateColumn >= DATEADD(dd, - (DAY(DATEADD(mm, 1, GetDate())) - 1), DATEADD(mm, - 1, GetDate()))
Edit: +1 to Russel Steen. I was posting mine before I knew he had posted.