Re: Last 3 months from now -
03-02-2010
, 06:54 PM
The best would be to use a half-open interval:
SELECT <columns>
FROM Foo
WHERE datecol >= DATEADD(MONTH, DATEDIFF(MONTH, 0, CURRENT_TIMESTAMP) - 3, 0)
AND datecol < DATEADD(MONTH, DATEDIFF(MONTH, 0, CURRENT_TIMESTAMP), 0);
--
Plamen Ratchev
http://www.SQLStudio.com |