【问题标题】:Impala: duplicate table alias when trying joining on multiple columnsImpala:尝试加入多个列时重复表别名
【发布时间】:2017-01-23 17:50:56
【问题描述】:

我想在多个列上保留外部连接表 A 和表 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'

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

【问题讨论】:

    标签: sql join hive impala


    【解决方案1】:

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

    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)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-12-01
      • 2015-05-30
      • 2014-10-26
      • 1970-01-01
      • 1970-01-01
      • 2020-11-05
      • 2015-12-25
      • 1970-01-01
      相关资源
      最近更新 更多