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 ( 2 years ago )
SELECT A.*,B.Tipo_Documento_Cd,B.Numero_Documento_Val,B.CUC_Num,B.Cod_Segmento_Merc_Val,B.Banca_Mercado_Desc 
FROM(
   SELECT CASE WHEN LENGTH(A.NUM_DOCUMENTO)=8 THEN '1' 
               WHEN LENGTH(A.NUM_DOCUMENTO)=9 THEN '3'
			   WHEN LENGTH(A.NUM_DOCUMENTO)=11 THEN '2'
		  END AS TIPO_DOCUMENTO_N, A.*        
	FROM E_DW_VIEWS.V_FEEDBACK_TELEVENTAS A        
	WHERE A.GESTION > (SELECT CAST(CAST(ADD_MONTHS(CAST(MAX(GESTION)||'01' AS DATE FORMAT 'YYYYMMDD'),-12) AS FORMAT 'YYYYMMDD') AS CHAR(6))         
	                   FROM E_DW_VIEWS.V_FEEDBACK_TELEVENTAS)     
    AND LENGTH(A.NUM_DOCUMENTO) IN (8,9,11)  
) A 
LEFT JOIN E_DW_VIEWS.V_MST_DATOS_COMPL_CLIE_VPC B 
ON A.TIPO_DOCUMENTO_N = B.Tipo_Documento_Cd 
   AND A.NUM_DOCUMENTO = B.Numero_Documento_Val 
WHERE A.CATEGORIA IN('CE','CNE','ET')
OR RESULTADO_LLAMADA LIKE '%(CE)%' 
OR RESULTADO_LLAMADA LIKE '%(AC)%' 
OR RESULTADO_LLAMADA LIKE '%ACEPTA%' 
OR RESULTADO_LLAMADA IN (
      'RETENCION EXITOSA TC', 'NM - No Acepta Repro - Pagará dentro de mes (NM)', 
    'CLIENTE YA FUE ATENDIDO', 'AP - Acepta Repro PP (AP)', 'LP - Lo Pensará (LP)', 'VL - Volver a llamar (VL)',
    'NO - No Acepta Repro - Otros (NO)', 'ID - No Acepta Repro - No quiere incrementar deuda (ID)', 'CANCELACION CTS',
    'TE - No Acepta Repro - Tasa Elevada (TE)', 'AT - Acepta Repro TC (AT)')
)

 

Revise this Paste

Your Name: Code Language: