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_2_BPE_JV as(
--5.- CTA NEG
SELECT CASE WHEN d.Tipo_Identificacion_Host='2' AND Numero_Identificacion LIKE '10%' THEN SUBSTRING(Numero_Identificacion, 3, 8) ELSE Numero_Identificacion END NUMDOC
, cast('5.- CTA NEG' 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
, 1 FLG_CTA_NEG
, 0 FLG_PROVEEDORES
, 0 FLG_CLIENTES
, 0 FLG_RESCATE_BE
, 0 FLG_BARRIDO_TLV_BPE
, 0 FLG_PNCN
, 0 FLG_RETAIL
--select count(1)
from E_DW_VIEWS.V_AGG_VPC_SALDOS_DIARIOS b
inner join E_DW_VIEWS.V_DIM_CLIENTE d
on d.Cliente_Id = b.Cliente_Id
where 1=1
--and b.Saldo_Promedio_Sol_Mto>0
and b.Categoria_Prod_VPC_Dsc like '%NEGOCIO%'
and b.Fecha_Saldo_Dt = ADD_MONTHS(CAST('202210'||'01' AS DATE FORMAT 'YYYYMMDD'),1)-1
UNION ALL
--6.- PROVEEDORES 7.- CLIENTES
SELECT CASE WHEN LENGTH(Ruc_Beneficiario) = 11 AND Ruc_Beneficiario LIKE '10%' THEN SUBSTRING(Ruc_Beneficiario, 3, 8) ELSE Ruc_Beneficiario END NUMDOC
--numero_ruc NUM_RUC,
, cast(case when Tipo ='CLIENTE' then '7.- CLIENTES' else '6.- PROVEEDORES' end 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
, (case when Tipo <> 'CLIENTE' then 1 else 0 end) FLG_PROVEEDORES
, (case when Tipo = 'CLIENTE' then 1 else 0 end) FLG_CLIENTES
, 0 FLG_RESCATE_BE
, 0 FLG_BARRIDO_TLV_BPE
, 0 FLG_PNCN
, 0 FLG_RETAIL
--select count(1)
--select max(Periodo_Val)
FROM E_DW_VIEWS.V_FACT_VPC_CORPORATIVO
where Periodo_Val = '202210'
) WITH DATA
PRIMARY INDEX (NUMDOC);
Revise this Paste