All Forums Teradata Studio
sush5777 1 post Joined 08/13
04 Aug 2013
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 

dnoeth 4628 posts Joined 11/04
04 Aug 2013

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

Dieter

You must sign in to leave a comment.