I am having troubled trying to figure out how to get the records of a table. As an example, I want to get all the records for the month of February if the current date is March 14, 2007. I am not too sure on how to use the datepart, dateadd, convert, getdate(). I have tried several ways, one of which was,
This just returned every record from one month ago from today's date. I need to get the records from 2/1/07 to 2/28/07
TIA
Mike
Code:
select column1, column2
from table1
where column1 >= dateadd(mm, -1, getdate())
and column1 < getdate()
This just returned every record from one month ago from today's date. I need to get the records from 2/1/07 to 2/28/07
TIA
Mike