Date Error in Syntax - Help

Teradata Studio

Date Error in Syntax - Help

Folks - I am getting errror in executing this statement....any help?

 

select WeekStartDate

BETWEEN ('5/1/2013' AND '5/15/2013') +1 as period

where WeekStartDate BETWEEN ('5/1/2013' AND '5/15/2013') < 7 

1 REPLY
Senior Apprentice

Re: Date Error in Syntax - Help

What are you trying to do?

There's only one recommended way to write a date: DATE '2012-05-01' anything else is error-prone.

select WeekStartDate

BETWEEN ('5/1/2013' AND '5/15/2013') +1

BETWEEN is a logical predicate and thus can only appear in WHERE/HAVING/QUALIFY/CASE WHEN.

"+1" would be something like "TRUE + 1"

where WeekStartDate BETWEEN ('5/1/2013' AND '5/15/ 2013') < 7 

"TRUE < 7" ?

Dieter