Query Problem
Teradata Teradata Discussion Forums Teradata.com Discussion Forum
Visit Teradata.com
Home       Guidelines    Member List
Welcome Guest ( Login | Register )
        


This online forum is for user-to-user discussions of Teradata products, and is not an official customer support channel for Teradata. If you require direct assistance, please contact Teradata support.


Query Problem Expand / Collapse
Author
Message
Posted 7/10/2007 12:56:22 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 7/25/2007 10:30:00 AM
Posts: 7, Visits: 1
update tabl_name
set
id = ( sel id as SCI
From cycle_Calendar
Where cde ='AC'
And id = (sel Min(id)
From cycle_calendar
Where cde = 'AC'
And ST_cde = -20))

When I execute this query, I get Syntax error. Expected something between '(' and 'sel'


SPS
Post #8129
Posted 7/11/2007 6:54:57 AM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: 6/9/2008 2:55:55 PM
Posts: 185, Visits: 2
That's an invalid syntax for Teradata. You cannot code a subselect within the SET clause of the UPDATE statement. Instead, you need to create a derived table and then use the column from the derived table in your set. Something like:

update tn
from tabl_name
,( sel id as SCI
From cycle_Calendar
Where cde ='AC'
And id = (sel Min(id)
From cycle_calendar
Where cde = 'AC'
And ST_cde = -20)) dt
set id = dt.SCI


Hope that helps.
Post #8156
« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 0 ( 0 guests, 0 members, 0 anonymous members )
No members currently viewing this topic.


All times are GMT -5:00, Time now is 12:31am

Powered By InstantForum.NET v4.1.4 © 2008
Execution: 0.094. 10 queries. Compression Disabled.