hive:按别名选择,按列名排序

bqf10yzr  于 2021-06-26  发布在  Hive
关注(0)|答案(1)|浏览(479)

当前查询不起作用:

select datetime as a
from coffee_chain
order by datetime;

有人知道原因吗。

iyfjxgzm

iyfjxgzm1#

使用

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

相关问题