为了督促自己记忆更加深刻!
例子
select *
from
(select pre_apply_no,name
from houbank_analysis_sh.t_xloan_loan_lable
where book_date between '2018-11-01' and '2019-02-28') as a
left join
(select name,phone_num
from houbank_stg.xloan_cr_apo_api_app_cj_contact_stg) as b
on a.pre_apply_no = b.objectid;
结果会报错。
------------------------------------
正确答案:
select * from
(select pre_apply_no,name
from houbank_analysis_sh.t_xloan_loan_lable
where book_date between '2018-11-01' and '2019-02-28') as a
left join
(select objectid,name,phone_num
from houbank_stg.xloan_cr_apo_api_app_cj_contact_stg) as b
on a.pre_apply_no = b.objectid;
tips:使用这种方式连接是要讲所需要的字段在子表中存在