-1
SELECT SUM(valor_parametros) FROM (SELECT valor_parametros,cnpj,data_movimento FROM (SELECT valor_parametros,cnpj,data_movimento,id FROM movimento GROUP BY MONTH(data_movimento) ORDER BY id DESC) movimento where YEAR(data_movimento)='2020' ORDER BY id DESC) AS T GROUP BY cnpj
for example: cnpj 13566400130 would have to return me 10.2
of the day 2020-05-08
,but the value of 10.20
of 2020-04-06
would have to return 20.40