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 ( 3 years ago )
SELECT NUMDOC,
MAX(FLG_MERCADO_BPE) FLG_MERCADO_BPE,
MAX(FLG_RESCATE_MICRO) FLG_RESCATE_MICRO,
MAX(FLG_RESCATE_BPE) FLG_RESCATE_BPE,
MAX(FLG_RESCATE_BE) FLG_RESCATE_BE,
MAX(FLG_BARRIDO_TLV_BPE) FLG_BARRIDO_TLV_BPE,
MAX(FLG_PROVEEDORES_CORPO) FLG_PROVEEDORES_CORPO
(logica)
UNION
SELECT CASE WHEN LENGTH(Ruc_Beneficiario) = 11 AND Ruc_Beneficiario LIKE '10%' THEN SUBSTRING(Ruc_Beneficiario, 3, 8) ELSE Ruc_Beneficiario END NUMDOC,
0 FLG_MERCADO_BPE,
0 FLG_RESCATE_MICRO,
0 FLG_RESCATE_BPE,
0 FLG_RESCATE_BE,
0 FLG_BARRIDO_TLV_BPE, --check
1 FLG_PROVEEDORES_CORPO
FROM E_DW_VIEWS.V_MST_VPC_CORPORATIVO
UNION
SELECT CASE WHEN LENGTH(NUM_DOCUMENTO) = 11 AND NUM_DOCUMENTO LIKE '10%' THEN SUBSTRING(NUM_DOCUMENTO, 3, 8) ELSE NUM_DOCUMENTO END NUMDOC,
0 FLG_MERCADO_BPE,
0 FLG_RESCATE_MICRO,
0 FLG_RESCATE_BPE,
0 FLG_RESCATE_BE,
1 FLG_BARRIDO_TLV_BPE, --check
0 FLG_PROVEEDORES_CORPO
FROM E_DW_VIEWS.V_FEEDBACK_TELEVENTAS
WHERE FEC_LLAMADA >= '2021-01-01'
AND (
ID_CAMPANIA like '%BPE%' OR ID_TRATAMIENTO like '%BPE%' OR TIP_CLIENTE like '%BPE%'
)
AND PREFIJO_CAMPANA = 'TLV'
UNION
(logica)
GROUP BY NUMDOC
Revise this Paste