All Forums Analytics
FM 1 post Joined 09/08
24 Sep 2008
Embedded Selects statements within a select stmt

Hi,I am new to Teradata but have worked previously with Oracle.I want to embed a select statement within another select statement likeselect t.col1,t.col2,(select x.colname from another_table x)from test tI am getting the following error:3706: Syntax error: expected something between '(' and the 'sel' keyword. Any ideas on how to get around this?Thanks

idontknow 25 posts Joined 07/07
24 Sep 2008

You will not be able to do this in a column selection, just use a join strategy to get the required result.

gam 2 posts Joined 08/12
22 Aug 2012


I'm curious if something has changed in this case, or till it doesnt work in TD.



ulrich 816 posts Joined 09/09
22 Aug 2012


Depends on your release. 

In 13.10 below works - query need to guarantee that only one row is returned!



select calendar_date, 

       (select count(*) from sys_calendar.calendar where year_of_calendar = extract(year from current_Date)) as num_of_days_in_year

from sys_calendar.calendar

where year_of_calendar = extract(year from current_date)


feel free to donate bitcoin:12kgAUHFUqvG2sQgaRBXFhCwyf9HXdkGud

You must sign in to leave a comment.