Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to write case statement

Status
Not open for further replies.

KennLambing

Technical User
Aug 12, 2011
1
US
I'm trying to write a case statement in teradata. So far I have:
Code:
Select.....

Case StartMinute
When Config.tblManagementUnit.TimeZone 'US/Central' then (StartMinute+60)
When Config.tblManagementUnit.TimeZone "US/Pacific" then (StartMinute+180)
When Config.tblManagementUnit.TimeZone "US/Mountain" then (StartMinute+120)
Else (StartMinute +0)
End

From....

Where...
Group by...
Having...
I get error 102 Incorrect syntax near 'Us/Central'. I would like to add the appropriate number of minutes to a start time to convert them all to Eastern Standard time. StartMinute is a column in one of the 4 tables I'm pulling from. If I omit the case statement piece, the query works fine. I've tried using " instead of '. I've tried using () instead of "", I've tried enclosing the "Startminute +" piece in single quotes, double quotes but it doesn't seem to help.

PS I'm fresh off the boat new to SQL/Teradata.

 
I think you should use the '=' operator. like below

Case
When Config.tblManagementUnit.TimeZone = "US/Central" then (StartMinute+60)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top