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 )
CREATE TABLE DLAB_PROGRAMADATOSVPC.HM_UNIVERSO_4_BPE as(	
	SELECT ZZ.CODDOC NUMDOC
		, cast('12.- RRLL POTENCIAL BPE' AS varchar(50)) CATEGORIA
		, 0 FLG_ADI
		, '.' logica_banca_mes_val, '.'  logica_banca_fin_val, '.'  Banca_Mes_Val, '.'  Banca_Fin_Val, '.'  LOGICA
		, 0 FLG_MERCADO_BPE
		, 0 FLG_RESCATE_BPE
		, 0 FLG_RESCATE_MICRO
		, 0 FLG_PJ
	    , 0 FLG_CTA_NEG
	    , 0 FLG_PROVEEDORES
	    , 0 FLG_CLIENTES
		, 0 FLG_RESCATE_BE
	    , 0 FLG_BARRIDO_TLV_BPE
		, 0 FLG_PNCN
		, 0 FLG_RETAIL
		, 1 FLG_RRLL_BPE_PJ
		, ZZ.FLG_RRLL_DNI_CARNETEXT
	FROM (
		SELECT S.CODDOC,
		       S.TIPDOC,
		       MAX(CASE WHEN TIPDOC IN ('1','3') THEN 1 ELSE 0 END) FLG_RRLL_DNI_CARNETEXT
		FROM E_DW_VIEWS.V_REP_LEGALES_SUNAT_HIST S
		INNER JOIN DLAB_PROGRAMADATOSVPC.HM_UNIVERSO_1_BPE U
		ON S.NUMRUC = U.NUMDOC
		LEFT JOIN E_DW_VIEWS.V_DATOS_PRINCIPALES_SUNAT_HIST P
		ON S.NUMRUC = P.NUMRUC
		WHERE 1 = 1
		AND S.ESTADO = 0
		AND S.FECPROCESO = '05/11/2022'
		AND P.FECPROCESO = '05/11/2022'
		AND P.NUMRUC LIKE '20%'
		GROUP BY S.CODDOC, S.TIPDOC		
	) ZZ
) WITH DATA
PRIMARY INDEX (NUMDOC);

 

Revise this Paste

Your Name: Code Language: