Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

Using static Day value in a particular Date - response (1) by dnoeth

$
0
0

To get the nth of a month (n=0 returns the last day of the previous month):

DATE  - (EXTRACT(DAY FROM DATE ) - n)

Caution, this works for a single calculation in an IN clause, but when you add a second value you'll get a strange syntax error message.
You must rewrite it as multiple ORed conditions instead.
Don't ask me why the parser insists upon that, as it's automatically rewriting any IN into the same ORed conditions :-)
 
Dieter
 


Viewing all articles
Browse latest Browse all 14773

Trending Articles