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 ( 8 months ago )
SELECT B.PERIODO_VAL,
       B.NOMBRE_DSC CAMPANHA,
       H.KEY_VALUE NUM_RUC
FROM E_DW_VIEWS.V_VPC_NEG_EMPRESAS_CAMP_VIG A
JOIN E_DW_VIEWS.V_VPC_NEG_CAMPANHAS_INST_VIG B ON B.CAMPANHA_INSTANCIA_ID=A.CAMPANHA_INSTANCIA_ID
JOIN E_DW_VIEWS.V_VPC_NEG_EMPRESAS_VIG C ON C.EMPRESA_ID=A.EMPRESA_ID
LEFT JOIN E_DW_VIEWS.V_VPC_NEG_CAMPANHAS_VIG J ON J.CAMPANHA_ID=B.CAMPANHA_ID
LEFT JOIN E_DW_VIEWS.V_MST_ENCRIP_NRO_DOC_MDL_HISTDIA H
ON H.NRO_DOC = C.NUM_RUC_CD
WHERE B.PERIODO_VAL = (SELECT MAX(PERIODO_VAL) FROM E_DW_VIEWS.V_VPC_NEG_CAMPANHAS_INST_VIG)
AND A.MOTIVONOACTIVO_DSC LIKE '%CONTACTO%'
AND C.NUM_RUC_CD <> '.'
AND C.NUM_RUC_CD NOT LIKE ''
AND (J.TIPO_CAMPANHA_DSC LIKE '%adq%' OR B.NOMBRE_DSC LIKE '%nuevo%')
AND C.NUM_RUC_CD NOT IN (
   SELECT NUM_DOCUMENTO FROM E_DW_VIEWS.V_FEEDBACK_TELEVENTAS
   WHERE 1 = 1
   AND (CATEGORIA IN ('CE', 'CNE', 'AC', 'NC') OR RESULTADO_LLAMADA LIKE '%(CE)%' OR RESULTADO_LLAMADA LIKE '%(AC)%'OR RESULTADO_LLAMADA LIKE '%ACEPTA%') 
   AND GESTION IN ('202306', '202305', '202304')
)
QUALIFY Row_Number() Over(PARTITION BY C.NUM_RUC_CD  ORDER BY B.PERIODO_VAL DESC) = 1

 

Revise this Paste

Your Name: Code Language: