Why subquery does not work in teradata?

Andrei Vasilev picture Andrei Vasilev · Nov 20, 2013 · Viewed 12.8k times · Source

I tried this

SELECT * 
FROM
( SELECT *
FROM mytable;
);

and this

SELECT * 
FROM
( SELECT *
FROM mytable
);

Why these simple queries do not execute in Teradata?

Answer

Santhosh picture Santhosh · Nov 20, 2013

@a_horse_with_no_name has pointed out clearly. It should be written like this.

SELECT * 
FROM
(
 SELECT *
FROM mytable
) as MY_TABLE;