Impala:尝试连接多个列时出现重复的表别名

问题描述:

我想在多列上留下外部连接表A和表B。下面是我的代码:Impala:尝试连接多个列时出现重复的表别名

select * from table_A 

    left outer join table_B 
    on (table_A.a1 = table_B.b1) 

    left outer join table_B 
    on (table_A.a2 = table_B.b2) 

但后来我得到了错误:

HiveServer2Error: AnalysisException: Duplicate table alias: 'table_B' 

有谁知道whatI做错了吗?谢谢!

使用不同的表别名,因为您要加入同一个表两次。

select * -- use column names here instead of * 
from table_A ta 
left outer join table_B tb1 on (ta.a1 = tb1.b1) 
left outer join table_B tb2 on (ta.a2 = tb2.b2)