select * from supp a inner join trd_acct b
on a.btch_id = 11170 AND a.btch_id = b.btch_id
UNION ALL
select * from supp a inner join trd_acct b
on a.btch_id = 11164 AND a.supp_id = b.supp_id
或者你可以试试 CASE EXPRESSION :
select * from supp a
inner join trd_acct b
on CASE WHEN a.btch_id = 11164 THEN a.supp_id
WHEN a.btch_id = 11170 THEN a.btch_id END
= CASE WHEN a.btch_id = 11164 THEN b.supp_id
WHEN a.btch_id = 11170 then b.btch_id END
2条答案
按热度按时间yfjy0ee71#
下面的查询在hive(hadoop)中运行良好-
我在Hive控制台中进行了测试。
cs7cruho2#
你可以用
UNION
:或者你可以试试
CASE EXPRESSION
: