Impala:尝试连接多个列时重复 table 别名

Impala: duplicate table alias when trying joining on multiple columns

我想在多列上左外连接 table A 和 table B。下面是我的代码:

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'

有谁知道我在这里做错了什么?谢谢!

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

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)