you can use a between function, something like the following should work.
Code:
Select
Column1,
Column2
From MyTable
Where DateColumn Between DateAdd(mm,-6,GetDate()) and GetDate()
one Note is that the above does not exclude the Time portion of the date from the comparison. To do that you would nee to Cast(Convert(varchar,DateColumn,101) as dateTime) and do the same arourn the GetDate() calls.
The cast convert does have some overhead but I have used it with extremely large data sets and it seems to be minimal.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.