hive拒绝此代码:
select a, b, a+b as c
from t
where c > 0
Run Code Online (Sandbox Code Playgroud)
说Invalid table alias or column reference 'c'。
我真的需要写一些类似的东西吗
select * from
(select a, b, a+b as c
from t)
where c > 0
Run Code Online (Sandbox Code Playgroud)
编辑:
c足够复杂,我不想重复它where a + b > 0hive如果要使用派生列,请使用公用表表达式。
with x as
(
select a, b, a+b as c
from t
)
select * from x where c >0
Run Code Online (Sandbox Code Playgroud)