我的查询是
with subs2 as(
Select columns
from t1
right join t2
on conditions
)
CREATE TABLE new_n row format delimited fields terminated by '|' STORED AS RCFile AS
Select columns
from subs2
left join charge2
on conditions
where conditions;
我得到的错误看起来像这样
cannot recognize input near 'CREATE' 'TABLE' 'new_n' in statement.
为什么会这样?
答案 0 :(得分:0)
我认为with
与select
一致。所以试试这个:
CREATE TABLE new_n row format delimited fields terminated by '|' STORED AS RCFile AS
with subs2 as (
Select columns
from t1
right join t2
on conditions
)
Select columns
from subs2 left join
charge2
on conditions
where conditions;
或者,您可以在没有with
:
CREATE TABLE new_n row format delimited fields terminated by '|' STORED AS RCFile AS
Select columns
from (Select columns
from t2 left join -- I much prefer `left join`
t1
on conditions
) subs2 left join
charge2
on conditions
where conditions;