Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
[email protected] webmail 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 ( 11 months ago )
SELECT COALESCE(A.periodo, '202308') periodo, A.campania,
	       T.KEY_VALUE coddoc, M.KEY_VALUE num_ruc, 
		   A.scorefinal_nr, A.primariesgo, A.oferta_calculada, A.rmaactual_bpe_final, A.rmaactual_consumo,
		   A.cemoferta, A.CEMOPERATIVO, A.costo_fondo_real, A.costo_fondo_redondeado, A.gasto_operativo, 
		   A.margen_comercial, A.tasapiso_real, A.tasapiso_redondeado
	FROM  DLAB_PROGRAMADATOSVPC.TMP_VMVP_CAMPANIA_BPE_FROM_RIESGOS_X A           ----------- todo la base de riesgos
	LEFT JOIN E_DW_VIEWS.V_MST_ENCRIP_NRO_DOC_MDL_HISTDIA M
	ON A.NUM_RUC = M.NRO_DOC
	LEFT JOIN E_DW_VIEWS.V_MST_ENCRIP_NRO_DOC_MDL_HISTDIA T
	ON A.CODDOC = T.NRO_DOC AND A.CODDOC <> '.' AND A.CODDOC IS NOT NULL AND A.CODDOC NOT LIKE ''
	WHERE 1 = 1
	AND A.NUM_RUC <> '.' 
	AND A.NUM_RUC IS NOT NULL 
	AND A.NUM_RUC NOT LIKE ''
	AND A.PERIODO = (SELECT MAX(PERIODO) FROM DLAB_PROGRAMADATOSVPC.TMP_VMVP_CAMPANIA_BPE_FROM_RIESGOS_X)
	AND A.NUM_RUC IN (SELECT NUM_RUC FROM DLAB_PROGRAMADATOSVPC.TMP_VMVP_RECARGA_RIESGOS)  ----- solo la recarga
	--AND A.campania NOT LIKE '%FACT%'
	--AND A.campania NOT LIKE '%ECO%'

 

Revise this Paste

Your Name: Code Language: