(1)valid置为0
将线下推广码赋给ext1,然后将线上推广码赋给线下推广码,把ext1赋给线上推广码,把ext1置为null
1.将线下推广码赋给ext1
update online_bra_off_rec_sub_bra a
set valid=0
where id in ((
select id from online_bra_off_rec_sub_bra
where sub_branch_org_code =a.sub_branch_org_code
) minus (select min(id) from online_bra_off_rec_sub_bra
where sub_branch_org_code =a.sub_branch_org_code))
and a.sub_branch_org_code in (
'5505',
'40DH',
'40DI',
'48D4',
'1100',
'7907',
'2605',
'E700',
'01J0')
(2)线上推广码、线下推广码反转
将线下推广码赋给ext1,然后将线上推广码赋给线下推广码,把ext1赋给线上推广码,把ext1置为null
1.将线下推广码赋给ext1
update online_bra_off_rec_sub_bra a
set
ext1=(
select OffLINE_PROMOTION_CODE
from online_bra_off_rec_sub_bra b
where a.sub_branch_org_code=b.sub_branch_org_code )
where
a.sub_branch_org_code in (
'A3D4',
'A3DF',
'A3D1',
'A3DB',
'A3DI',
'A3DA')
2.然后将线上推广码赋给线下推广码
update online_bra_off_rec_sub_bra a
set
OffLINE_PROMOTION_CODE=(
select OnLINE_PROMOTION_CODE
from online_bra_off_rec_sub_bra b
where a.sub_branch_org_code=b.sub_branch_org_code )
where
a.sub_branch_org_code in (
'A3DI',
'A3DA')
3.把ext1赋给线上推广码
update online_bra_off_rec_sub_bra a
set
OnLINE_PROMOTION_CODE=(
select ext1
from online_bra_off_rec_sub_bra b
where a.sub_branch_org_code=b.sub_branch_org_code )
where
a.sub_branch_org_code in (
'A3D4',
'A3DF',
'A3DI',
'A3DA')
4.把ext1置为null
update online_bra_off_rec_sub_bra a
set
ext1=null
where
a.sub_branch_org_code in (
'A3DI',
'A3DA')