Sql 配置单元:按别名选择,按列名排序

Sql 配置单元:按别名选择,按列名排序,sql,hive,sql-order-by,alias,Sql,Hive,Sql Order By,Alias,当前查询不起作用: select datetime as a from coffee_chain order by datetime; 有人知道原因吗。使用 select datetime as a from coffee_chain order by a; 使用 我们应该猜猜您的表和查询是什么样子的吗?:)sry,兄弟。我忘了。我们应该猜一下您的表和查询是什么样子吗?:)sry,兄弟。我忘了,谢谢。你知道为什么不能按顺序使用列名吗?好像蜂巢有限谢谢。你知道为什么不能按顺序使用列名吗

当前查询不起作用:

select datetime as a
from coffee_chain
order by datetime;
有人知道原因吗。

使用

select datetime as a from coffee_chain order by a;


使用



我们应该猜猜您的表和查询是什么样子的吗?:)sry,兄弟。我忘了。我们应该猜一下您的表和查询是什么样子吗?:)sry,兄弟。我忘了,谢谢。你知道为什么不能按顺序使用列名吗?好像蜂巢有限谢谢。你知道为什么不能按顺序使用列名吗?看起来像是蜂巢限制
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