kartik
kartik

Reputation: 93

Multi-join query in hive

SELECT t.col1, t.col2, t.col3, e.col1
FROM table1 t
JOIN table2 s
ON (t.col1 = s.col1) sv
JOIN table3 e
ON (sv.col1 = e.col1) svv
JOIN table4 c
ON (svv.col3 = c.col3);

I am new to hive and I am not good at sql either. I was trying to run a multi-join query, but I keep getting this error:

Failed to recognize predicate 'sv'. Failed rule: 'kwInner' in join type specifier

Upvotes: 0

Views: 206

Answers (1)

hasan
hasan

Reputation: 553

remove the aliases 'sv', 'svv'. i am not sure what you try to do but you already set aliases for your tables with the characters 's', 'e' and 'c'. My advice for you: use concrete identifiers as aliases with a join you do here you will lose the focus very fast.

I assume you want to do the following:

SELECT t1.col1, t1.col2, t1.col3, t3.col1
FROM table1 t1
JOIN table2 t2
ON (t1.col1 = t2.col1)
JOIN table3 t3
ON (t2.col1 = t3.col1) 
JOIN table4 t4
ON (t3.col3 = t4.col3); 

Upvotes: 1

Related Questions