created < (getdate() - 180)
Of course not all months are 30 days so this isn't 100% accurate. I need to be 100% accurate but haven't found a better solution.
Can someone suggest a better solution?
Thanks.
Maybe CREATED < dateadd (mm, - 6, getdate()) ?|||
Depends on exactly what you mean by 6 months..
You could say
select dateadd(month,-6,getdate())
So for today, it would be 2006-11-16 15:01:04.490 since my current getdate is 2007-05-16 15:01:04.490. I think this actually makes the most sense, as it does not really concern itself with the number of days.
However, if you need the fixed number of days to give you a consistent comparison, 180 days is a good thing too.)
No comments:
Post a Comment