Last 6 Month in Query - Failing on August 30

General

Last 6 Month in Query - Failing on August 30

...WHERE DB.LOG_DATE > DATE - INTERVAL '6' MONTH;

This has been working for weeks, until today. I wasn't sure what broke my script until I tried dropping the date requirement and then it started working perfectly. 6 month ago is February 30, I am guessing, by TD logic, which doesn't exist.

Any general solutions?

2 REPLIES
N/A

Re: Last 6 Month in Query - Failing on August 30

This is not Teradata logic, it's stupid Standard SQL (In fact you can't use INTERVAL-syntax for both YEAR and MONTH).

That's why there's ADD_MONTHS :-)

WHERE DB.LOG_DATE > ADD_MONTHS(DATE,-6);

Re: Last 6 Month in Query - Failing on August 30

Thank you!