My query is
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;
The error I get looks like this
cannot recognize input near 'CREATE' 'TABLE' 'new_n' in statement.
Why is this happening?
I think the with
goes with the select
. So try this:
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;
Or, you can rewrite without the 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;
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments