首页 > 解决方案 > 处理 hive 中多个表的连接

问题描述

下面是表a、b、c、d和x的表结构

编写一个查询来查找 id,我希望这可以使用 case 语句来完成,但不知道如何将其放入查询中。

table a
id name address

table b
id name dept

table c
id name dept sal

table d
id name dept address

table x
id name dept address ......

a join x (on id)

if id is null then
a join b (on name and get id) then join x(on id)

if name is null then
a join c (on dept and get name) then join b (on name and get id) then join x(on id)

if dept is null then
a join d(on address get id) then join x on id

标签: sqljoinhive

解决方案


推荐阅读