表fx_yl_card_acct a 字段fx_account_id fx_customer_id
表fx_yl_card_cstm c 字段fx_crtft_number fx_customer_id
表fx_yl_card_trans d 字段fx_cif_no fx_cif_no_type fx_account_id
表cif_id_code_rel e 字段id_no cif_no cif_no_type
要更新或者插入表fx_yl_card_trans 中字段fx_cif_no fx_cif_no_type所有的值
1、从fx_yl_card_trans d表中查出所有的d.fx_account_id
2、这个字段对应表fx_yl_card_acct a 字段a.fx_account_id
3、再根据表fx_yl_card_acct a 字段a.fx_account_id 查出这个表中每条数据对应的a.fx_customer_id字段
4、根据3求出的a.fx_customer_id字段 == 表fx_yl_card_cstm c 中的c.fx_customer_id
5、根据表fx_yl_card_cstm c 中的c.fx_customer_id 查出对应的每条数据的c.fx_crtft_number
6、 5中求出的c.fx_crtft_number == 表cif_id_code_rel e 字段e.id_no
7、把6中的id_no字段对应的e.cif_no e.cif_no_type 插入到 fx_yl_card_trans d表d.fx_cif_no d.fx_cif_no_type好像越说说不清楚了悲催。、、
总之就是把fx_yl_card_trans表中的fx_cif_no fx_cif_no_type赋值,这两个字段的数据在表cif_id_code_rel中
表fx_yl_card_cstm c 字段fx_crtft_number fx_customer_id
表fx_yl_card_trans d 字段fx_cif_no fx_cif_no_type fx_account_id
表cif_id_code_rel e 字段id_no cif_no cif_no_type
要更新或者插入表fx_yl_card_trans 中字段fx_cif_no fx_cif_no_type所有的值
1、从fx_yl_card_trans d表中查出所有的d.fx_account_id
2、这个字段对应表fx_yl_card_acct a 字段a.fx_account_id
3、再根据表fx_yl_card_acct a 字段a.fx_account_id 查出这个表中每条数据对应的a.fx_customer_id字段
4、根据3求出的a.fx_customer_id字段 == 表fx_yl_card_cstm c 中的c.fx_customer_id
5、根据表fx_yl_card_cstm c 中的c.fx_customer_id 查出对应的每条数据的c.fx_crtft_number
6、 5中求出的c.fx_crtft_number == 表cif_id_code_rel e 字段e.id_no
7、把6中的id_no字段对应的e.cif_no e.cif_no_type 插入到 fx_yl_card_trans d表d.fx_cif_no d.fx_cif_no_type好像越说说不清楚了悲催。、、
总之就是把fx_yl_card_trans表中的fx_cif_no fx_cif_no_type赋值,这两个字段的数据在表cif_id_code_rel中
(select fx_account_id ,
cif_no ,
cif_no_type
from fx_yl_card_acct a,
fx_yl_card_cstm c,
cif_id_code_rel e
where a.fx_customer_id=c.fx_customer_id
and c.fx_crtft_number = e.id_no)merge into fx_yl_card_trans t1
using tb t2
on (t1.fx_account_id = t2.fx_account_id)
when matched then
update set
t1.fx_cif_no=t2.cif_no ,
t1.fx_cif_no_type= t2.cif_no_type
when not matched then
insert values
(t2.fx_account_id ,t2.cif_no ,t2.cif_no_type )