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 ( 11 months ago )
SELECT periodo_campania, producto, count(1) conteo, count(distinct(num_ruc)) conteo_unicos
FROM d_mdl_vpc_disc.HM_DESPLIEGUE_CAMPANIAS
GROUP BY periodo_campania, producto
ORDER BY periodo_campania DESC, producto
DROP TABLE IF EXISTS d_mdl_vpc_disc.HM_FEEDBACK_TLV_PRICING
CREATE TABLE d_mdl_vpc_disc.HM_FEEDBACK_TLV_PRICING
WITH ( format = 'Parquet',
parquet_compression = 'SNAPPY',
partitioned_by = ARRAY['p_periodo'],
external_location= 's3://sagemaker-us-east-1-058528764918/vpc/princingbpe/athenav2/HM_FEEDBACK_TLV_PRICING/'
)
AS (
SELECT gestion,
num_ruc_autocompletado,
CASE WHEN campania = 'NUEVOS PRE' OR lower(nom_lista) like '%dig_c%' THEN 'NUEVOS PRE'
WHEN campania in ('NUEVOS AP', 'ECOSISTEMAS') OR lower(nom_lista) like '%dig_b%' THEN 'NUEVOS AP'
ELSE 'X' END campania,
MAX(CASE WHEN campania = 'NUEVOS PRE' OR lower(nom_lista) like '%dig_c%' then 1 else 0 end) flg_nuevos_pre,
MAX(CASE WHEN campania in ('NUEVOS AP', 'ECOSISTEMAS') OR lower(nom_lista) like '%dig_b%' then 1 else 0 end) flg_nuevos_ap,
MAX(coalesce(flg_gestionado_estricto, 0)) flg_gestionado_estricto,
MAX(coalesce(flg_ce, 0)) flg_ce,
MAX(coalesce(flg_cne, 0)) flg_cne,
MAX(coalesce(flg_et, 0)) flg_et,
MAX(coalesce(flg_no_acepta_campana, 0)) flg_no_acepta_campana,
MAX(coalesce(flg_tasa_elevada, 0)) flg_tasa_elevada,
MAX(coalesce(flg_lo_pensara, 0)) flg_lo_pensara,
MAX(coalesce(flg_acepta_campana, 0)) flg_acepta_campana,
MAX(coalesce(flg_no_califica, 0)) flg_no_califica,
SUM(flg_gestionado_estricto) gestion_total,
SUM(flg_ce) ce_total,
SUM(flg_acepta_campana) ac_total,
gestion p_periodo
FROM e_perm_aws.ds_csfedtlv_pso
WHERE 1 = 1
AND (
flg_bpe = 1
OR lower(nom_lista) like '%bpe%'
)
AND (
CAMPANIA IN ('NUEVOS AP', 'ECOSISTEMAS', 'NUEVOS PRE')
OR lower(nom_lista) like '%dig_c%'
OR lower(nom_lista) like '%dig_b%'
)
GROUP BY gestion,
CASE WHEN campania = 'NUEVOS PRE' OR lower(nom_lista) like '%dig_c%' THEN 'NUEVOS PRE'
WHEN campania in ('NUEVOS AP', 'ECOSISTEMAS') OR lower(nom_lista) like '%dig_b%' THEN 'NUEVOS AP'
ELSE 'X' END,
num_ruc_autocompletado
)
Revise this Paste