Thanks Rohit,

That is good to know, after think it again, yes, this is wrong in the first 
place. I tested in Hive, it doesn’t support that syntax either, but seems some 
RDBMS (Oracle, DB2) allow this syntax but ignore it.

However, It will be more user friendly that optimizer or parser simply give a 
warning or ignore it, because other database allows this, but since itself is 
wrong at first, so this ‘enhancement’ is not necessary, just if Trafodion could 
do that, that seems more flexible.

Thanks,
Ming

发件人: Rohit [mailto:rohit.j...@esgyn.com]
发送时间: 2016年3月24日 18:12
收件人: Liu, Ming (Ming) <ming....@esgyn.cn>; user@trafodion.incubator.apache.org
主题: RE: Does Trafodion support to use 'order by' in a subquery

Order by is allowed only on the outermost select in ANSI. It is meant to define 
the order of the final results of the query returned to the user. It is not 
allowed in sub queries.

Rohit


-------- Original message --------
From: "Liu, Ming (Ming)" <ming....@esgyn.cn<mailto:ming....@esgyn.cn>>
Date: 03/24/2016 2:15 AM (GMT-06:00)
To: 
user@trafodion.incubator.apache.org<mailto:user@trafodion.incubator.apache.org>
Subject: Does Trafodion support to use 'order by' in a subquery
Hi, all,

I don’t know if this is same in other database, but in Trafodion, if I want to 
have a subquery which have a ‘order by’, it seems not allowed. Is this normal 
or a limitation in Trafodion?
For example:

create table t1 ( c1 int, c2 int);

select * from (
   Select * from t1 order by c1);
*** ERROR[15001] A syntax error occurred at or before:
select * from (select * from t1 order by c1);
                                           ^ (44 characters from start of SQL 
statement)

Thanks in advance,
Ming

Reply via email to