Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
[email protected] web/email now available. Want one? Go here.
Cannot use outlook/hotmail/live here to register as they blocking our mail servers. #microsoftdeez
Obey the Epel!

Paste

Pasted as SQL by registered user vvillacorta ( 4 months ago )
with df_cf as (
    select num_ruc_hash, num_telefono, prob, codmes_ejecucion, codmes_campana,
    row_number() over( partition by codmes_ejecucion, codmes_campana, num_ruc_hash, num_telefono order by  fec_proceso desc, prob desc) as orden
    from d_mdl_vpc_disc.HM_UNIVERSO_SCORE_RUC_TEL_CF2
    WHERE codmes_campana >= '202405'
),
df_sf as (
    select num_ruc_hash, num_telefono, prob, codmes_ejecucion, codmes_campana,
    row_number() over( partition by codmes_ejecucion, codmes_campana, num_ruc_hash, num_telefono order by  fec_proceso desc, prob desc) as orden
    from d_mdl_vpc_disc.HM_UNIVERSO_SCORE_RUC_TEL_SF2
    WHERE codmes_campana >= '202405'
)
SELECT UU.num_ruc_hash, UU.num_telefono, UU.prob, UU.codmes_ejecucion, UU.codmes_campana,
       row_number() over( partition by UU.codmes_ejecucion, UU.codmes_campana, UU.num_ruc_hash order by prob desc) as prioridad_telefono
FROM(    
    select *
    from df_cf
    where orden = 1
    union 
    select *
    from df_sf
    where orden = 1
) UU

 

Revise this Paste

Your Name: Code Language: