join left 大数据_left join 陷阱之一对多导致数据量增加?

insert into tmp_linshi_type (prod_type,acc_nbr,shouligonghao,shouligou,lanzhuangrenjigou,subs_date,lanzhuanggonghao,qudaoxiaolei,jieruhaozhuangtai,

threeM,fourM,fiveM,acc_nbr_gui,serv_type_gui,del_gui,shouli_date_gong,qudaofuwu_gong,acc_nbr_yue,del_yue,gongdanlaiyuan_yue,acc_nbr_yue_jd,del_yue_jd,gongdanlaiyuan_yue_jd)

select distinct a.prod_type,a.acc_nbr,a.shouligonghao,a.shouligou,a.lanzhuangrenjigou,a.subs_date,a.lanzhuanggonghao,a.qudaoxiaolei,a.jieruhaozhuangtai,

a.threeM,a.fourM,a.fiveM,b.SUBS_NBR || ',',b.serv_type,b.ANSWER,c.act_date,c.CHANNEL_SERV,d.SUBS_NBR || ',',d.SERV_TYPE,d.ACT_REMARK,e.SUBS_NBR || ',',e.SERV_TYPE,e.TS_STATUS

from tmp_linshi_itv a

left join

(

select CUST_PHONE,SUBS_NBR,serv_type,ANSWER from RPT_ALL_SUBS_FILE_LIST_2018

union all

select CUST_PHONE,SUBS_NBR,serv_type,ANSWER from RPT_ALL_SUBS_FILE_LIST_201712

) b on a.acc_nbr = b.CUST_PHONE

left join RPT_GONGXIN c on a.acc_nbr = c.sg_nbr and c.month_id >= '201706'

left join RPT_provin_YJ d on a.acc_nbr = d.CUST_NBR and d.month_id >= '201706'

left join RPT_JITUAN_YJ e on a.acc_nbr = e.SHGAO_NBR and e.month_id >= '201706';

如标题,求去重方法或思路,谢谢!!!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值