with trx_fintech_target as (
select periodo_val,
cuc_ordenante_num cuc_envia,
cuc_beneficiario_num cuc_recibe,
origen1_moneda_cd moneda,
origen1_amt monto
from e_perm_aws.t_fct_transaccion_canal_agg
where (cuc_ordenante_num <> cuc_beneficiario_num)
and periodo_val = '{p_2}' -- Fecha +1m
and (
cuc_ordenante_num IN (
'0017819863',
'0013838893',
'0019177248',
'0017281729',
'0017038274',
'0014896824',
'0017643959',
'0016204752',
'0017631148',
'0018026700',
'0017751714',
'0016705043',
'0017735391',
'0017872400',
'0018238449',
'0016208206',
'0016587765',
'0015410577',
'0018332494',
'0017883362',
'0015791534',
'0016973891',
'0019024155',
'0012078513',
'0018133897',
'0017758834',
'0018967290',
'0017363378',
'0015562200',
'0017692418',
'0017077346',
'0017695593',
'0018251959',
'0017570994',
'0016306284',
'0018878460',
'0018106089',
'0014208439',
'0016138011',
'0016466243',
'0017049679',
'0015833243',
'0016403691',
'0018397079',
'0017904690',
'0016724316',
'0019638701',
'0019287189',
'0018648196',
'0016241440',
'0019880661',
'0018040954',
'0017883812',
'0015072190',
'0018133276',
'0018582023',
'0017810826',
'0018216437',
'0013264532',
'0016979436',
'0015899753',
'0018958374',
'0017850522',
'0013078358',
'0016060059',
'0018630129',
'0018158142',
'0016384241',
'0017129575',
'0016116546',
'0018885677',
'0019191639',
'0017762564',
'0017128885',
'0018782149',
'0005876032',
'0016416699',
'0016153136',
'0013441450',
'0018131010',
'0016713782',
'0018930193',
'0018578870',
'0017063562',
'0018508812',
'0017314089',
'0016143684',
'0015743151',
'0019167143',
'0016179690',
'0017334635',
'0018118335',
'0015471937',
'0017493102',
'0016134094',
'0018027040',
'0016049612',
'0017321658',
'0019635395',
'0016216762',
'0000041491',
'0015075585',
'0015973968',
'0017058764',
'0017136103',
'0010626918',
'0016120217',
'0011948960',
'0018261508',
'0019658620',
'0011457039',
'0018079594',
'0017612183',
'0017829027',
'0017455861',
'0018625157',
'0018401738',
'0015338354',
'0017668786',
'0019558896',
'0016974818',
'0016039213',
'0017822540',
'0015675395',
'0019156213',
'0016052254',
'0018565974',
'0015942512',
'0018675697',
'0015813297',
'0016081698',
'0018210689',
'0018518480',
'0016096998',
'0019087287',
'0019211590',
'0016068528',
'0016189260',
'0019355241',
'0017028050',
'0017380540',
'0015935666',
'0019114462',
'0015997922',
'0017744253'
)
or cuc_beneficiario_num IN (
'0017819863',
'0013838893',
'0019177248',
'0017281729',
'0017038274',
'0014896824',
'0017643959',
'0016204752',
'0017631148',
'0018026700',
'0017751714',
'0016705043',
'0017735391',
'0017872400',
'0018238449',
'0016208206',
'0016587765',
'0015410577',
'0018332494',
'0017883362',
'0015791534',
'0016973891',
'0019024155',
'0012078513',
'0018133897',
'0017758834',
'0018967290',
'0017363378',
'0015562200',
'0017692418',
'0017077346',
'0017695593',
'0018251959',
'0017570994',
'0016306284',
'0018878460',
'0018106089',
'0014208439',
'0016138011',
'0016466243',
'0017049679',
'0015833243',
'0016403691',
'0018397079',
'0017904690',
'0016724316',
'0019638701',
'0019287189',
'0018648196',
'0016241440',
'0019880661',
'0018040954',
'0017883812',
'0015072190',
'0018133276',
'0018582023',
'0017810826',
'0018216437',
'0013264532',
'0016979436',
'0015899753',
'0018958374',
'0017850522',
'0013078358',
'0016060059',
'0018630129',
'0018158142',
'0016384241',
'0017129575',
'0016116546',
'0018885677',
'0019191639',
'0017762564',
'0017128885',
'0018782149',
'0005876032',
'0016416699',
'0016153136',
'0013441450',
'0018131010',
'0016713782',
'0018930193',
'0018578870',
'0017063562',
'0018508812',
'0017314089',
'0016143684',
'0015743151',
'0019167143',
'0016179690',
'0017334635',
'0018118335',
'0015471937',
'0017493102',
'0016134094',
'0018027040',
'0016049612',
'0017321658',
'0019635395',
'0016216762',
'0000041491',
'0015075585',
'0015973968',
'0017058764',
'0017136103',
'0010626918',
'0016120217',
'0011948960',
'0018261508',
'0019658620',
'0011457039',
'0018079594',
'0017612183',
'0017829027',
'0017455861',
'0018625157',
'0018401738',
'0015338354',
'0017668786',
'0019558896',
'0016974818',
'0016039213',
'0017822540',
'0015675395',
'0019156213',
'0016052254',
'0018565974',
'0015942512',
'0018675697',
'0015813297',
'0016081698',
'0018210689',
'0018518480',
'0016096998',
'0019087287',
'0019211590',
'0016068528',
'0016189260',
'0019355241',
'0017028050',
'0017380540',
'0015935666',
'0019114462',
'0015997922',
'0017744253'
)
)
),
fintech_target as (
select distinct case
when cuc_envia in (
'0017819863',
'0013838893',
'0019177248',
'0017281729',
'0017038274',
'0014896824',
'0017643959',
'0016204752',
'0017631148',
'0018026700',
'0017751714',
'0016705043',
'0017735391',
'0017872400',
'0018238449',
'0016208206',
'0016587765',
'0015410577',
'0018332494',
'0017883362',
'0015791534',
'0016973891',
'0019024155',
'0012078513',
'0018133897',
'0017758834',
'0018967290',
'0017363378',
'0015562200',
'0017692418',
'0017077346',
'0017695593',
'0018251959',
'0017570994',
'0016306284',
'0018878460',
'0018106089',
'0014208439',
'0016138011',
'0016466243',
'0017049679',
'0015833243',
'0016403691',
'0018397079',
'0017904690',
'0016724316',
'0019638701',
'0019287189',
'0018648196',
'0016241440',
'0019880661',
'0018040954',
'0017883812',
'0015072190',
'0018133276',
'0018582023',
'0017810826',
'0018216437',
'0013264532',
'0016979436',
'0015899753',
'0018958374',
'0017850522',
'0013078358',
'0016060059',
'0018630129',
'0018158142',
'0016384241',
'0017129575',
'0016116546',
'0018885677',
'0019191639',
'0017762564',
'0017128885',
'0018782149',
'0005876032',
'0016416699',
'0016153136',
'0013441450',
'0018131010',
'0016713782',
'0018930193',
'0018578870',
'0017063562',
'0018508812',
'0017314089',
'0016143684',
'0015743151',
'0019167143',
'0016179690',
'0017334635',
'0018118335',
'0015471937',
'0017493102',
'0016134094',
'0018027040',
'0016049612',
'0017321658',
'0019635395',
'0016216762',
'0000041491',
'0015075585',
'0015973968',
'0017058764',
'0017136103',
'0010626918',
'0016120217',
'0011948960',
'0018261508',
'0019658620',
'0011457039',
'0018079594',
'0017612183',
'0017829027',
'0017455861',
'0018625157',
'0018401738',
'0015338354',
'0017668786',
'0019558896',
'0016974818',
'0016039213',
'0017822540',
'0015675395',
'0019156213',
'0016052254',
'0018565974',
'0015942512',
'0018675697',
'0015813297',
'0016081698',
'0018210689',
'0018518480',
'0016096998',
'0019087287',
'0019211590',
'0016068528',
'0016189260',
'0019355241',
'0017028050',
'0017380540',
'0015935666',
'0019114462',
'0015997922',
'0017744253'
) then cuc_recibe
else cuc_envia
end cuc_cliente
from trx_fintech_target
)
select a.codmes,
a.tipdoc tip_doc,
a.coddoc key_value,
case
when b.cuc in (
select cuc_cliente
from fintech_target
) then 1
else 0
end target,
a.puntuacion predicted,
a.grupo_ejec
from e_perm_aws.scr_tdcfintech a
inner join (
select distinct cuc,
key_value
from e_perm_aws.t_aws_360_cliente_mes_d3
where cod_tipo_documento = 1
) b on a.coddoc = b.key_value
where a.fecinformacion = '{p_3}' and a.grupo_ejec = 1
Add a code snippet to your website: www.paste.org