Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so dont bother with any of their useless mail servers here and just use oauth login instead. Thank the nice Russians for causing that. :)

Paste

Pasted as Plain Text by registered user vvillacorta ( 5 years ago )
CREATE TABLE vpc..........T_MERCADO_BPE_ADQ_SF_P01
		WITH ( format = 'Parquet', 
			   parquet_compression = 'SNAPPY', 
			   partitioned_by = ARRAY['PERIODO'], 
			   external_location= 's3://......................................................................./T_MERCADO_BPE_ADQ_SF_P01/'
			 )
		AS (
		  
		SELECT 
			  cod_sbs_val AS CODSBS,
			  producto_rcc_desc AS PRODUCTO,
			  situacion_rcc_desc AS SITUACION,
			  empresa_cd AS COD_EMPRESA,
			  tipo_producto_rcc_desc TIPO_PRODUCTO,
			  SUM(saldo_amt) MTO_SALDO,
			  periodo_val AS PERIODO
		   FROM e_..................T_VPC_FACT_SALDOS_RCC
		   WHERE 1 = 1
		   AND tipo_producto_rcc_desc IN (
			 'COL. DIRECTAS','REACTIVA','COL. INDIRECTAS','FAE','INMOBILIARIO'
		   )
                   AND cod_sbs_val in (select cod_sbs_val from ................t_vpc_segmentacion_merc where banca_fin_val = 'BPE' or banca_mes_val = 'BPE')
		   AND 
		   (
			  (
				  flg_lin_mercado = 'S' AND
				  --(
					producto_rcc_desc NOT IN ('OTROS') 
					--OR 
					--(
					--  B.PRODUCTO ='OTROS' AND 
					--  B.DETALLE IN ('FINANCIACION DE PROYECTOS')
					--)
				  --)
			  )					
			  OR tipo_producto_rcc_desc IN ('REACTIVA','FAE','INMOBILIARIO')
		  )
		  GROUP BY 
			  periodo_val,
			  cod_sbs_val,
			  producto_rcc_desc,
			  situacion_rcc_desc,
			  empresa_cd,
			  tipo_producto_rcc_desc
		)

 

Revise this Paste

Your Name: Code Language: