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 ( 3 months ago )
SELECT A.PERIODO,
           A.TIPO_PO,
           SUM(B.ingreso_total_final),
           COUNT(DISTINCT(A.CDOUNICO)) CANT
    FROM d_mdl_vpc_disc.HM_OBM_IND_BPE_V1 A
    INNER JOIN d_mdl_vpc_disc.MM_OBM_VPC_INGRESOS b
    ON A.cdounico = B.CODUNICO 
    AND A.PERIODO=substr(replace(substr(cast(date_add('month', +1, date_parse(B.PERIODO ,'%Y%m')) as varchar), 1, 10), '-', ''), 1, 6)
    --WHERE TIPO_PO=1
    GROUP BY A.PERIODO,A.TIPO_PO

 

Revise this Paste

Your Name: Code Language: