简体   繁体   中英

Hive: select by alias and order by column name

Current query, which doesn't work:

select datetime as a
from coffee_chain
order by datetime;

Can some one know the reason.

use

select datetime as a from coffee_chain order by a;

https://issues.apache.org/jira/browse/HIVE-1449


hive> create table coffee_chain (datetime int);
OK

hive> select datetime as a from coffee_chain order by datetime;
 FAILED: SemanticException Line 0:-1 Invalid table alias or column reference 'datetime': (possible column names are: a) 
hive> select datetime as a from coffee_chain order by a;
OK

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM