我试图重写Hive上的follow查询
select
TFCT_CHARGE.SUBS_KEY,
TFCT_CHARGE.PRODUCT_KEY,
TFCT_CHARGE.CHARGE_NVAL,
TFCT_CHARGE.B_SUBS_KEY,
TFCT_CHARGE.DELETE_DT,
HFCT_SUBS_SEGMENT.SEGMENT_KEY,
TFCT_CHARGE.EVENT_DT,
TFCT_CHARGE.DWH_SRC_TABLE_KEY
from
TFCT_CHARGE LEFT OUTER JOIN HFCT_SUBS_SEGMENT
ON (
TFCT_CHARGE.B_SUBS_KEY = HFCT_SUBS_SEGMENT.SUBS_KEY and
TFCT_CHARGE.EVENT_DT >= HFCT_SUBS_SEGMENT.EFF_DT and
TFCT_CHARGE.EVENT_DT < HFCT_SUBS_SEGMENT.EXP_DT and
HFCT_SUBS_SEGMENT.SEGMENT_TYPE_KEY = 1)
但也有不平等的质疑。有人能给我一些解决办法吗?tnx!
2条答案
按热度按时间yrdbyhpb1#
要模拟非等距左外联接,请执行以下操作:
创建左表的副本,并添加序列行号
进行内部连接:
按序列左连接:
请参阅我的答案这里的代码:配置单元:工作为非等左连接
l7mqbcuq2#
很简单)