Using MONTH in case statement

Database

Using MONTH in case statement

Can someone explain why this case statement does not work?

CASE WHEN MONTH(ORDER_DATE) = MONTH(DATE) THEN 'M' ELSE '' END CUR_MON

I received this error: 

Statement 2 - 3706:  Syntax error: expected something between the 'WHEN' keyword and the 'MONTH' keyword.

I am using Teradata 12.00.00.10

Thank you for your help!

Jackie

2 REPLIES
Teradata Employee

Re: Using MONTH in case statement

Because there is no MONTH function. Try EXTRACT(MONTH FROM ORDER_DATE) = EXTRACT(MONTH FROM DATE).

Re: Using MONTH in case statement

That works.  Thank you so much!

Since I was using MONTH to select the month from dates in my select statement, I assumed it was the same syntax.  I'm not used to Teradata syntax just yet.

Jackie