我从 java 代码tableHiveCell
和tableHiveWiFi
.
当我尝试运行以下 sql 命令时:
select count(UEs.cnc) as 'Active UEs'
^
from
(select distinct cnc from tableHiveCell wifi
union
select distinct cnc from tableHiveCell cell)
as UEs;
我收到一个错误:
java.sql.SQLException:
Query returned non-zero code: 11,
cause: FAILED: Parse Error: line 1:22 mismatched input 'as' expecting FROM near ')' in from clause
at org.apache.hadoop.hive.jdbc.HiveStatement.executeQuery(HiveStatement.java:189).
我错过了什么?
[编辑 1]
我试过了:
select count(UEs.cnc) as 'Active UEs'
^
from
(select distinct cnc from tableHiveCell wifi)
union
(select distinct cnc from tableHiveCell cell)
as UEs;
同样的错误
[编辑 2]
我试过了:
select count(UEs.cnc) as Active_UEs
from (select distinct cnc from tableHiveCell wifi
union ALL
select distinct cnc from tableHiveCell cell) as UEs;
^
得到相同的错误,但最后一个as
:
line 1:142 mismatched input 'as' expecting Identifier near ')' in subquery source