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 SQL by registered user vvillacorta ( 2 years 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