0
I have a problem in the code below. When I put to add the field valor
table lnota
, it brings a wrong result of the account; if I leave only the field, it brings the right value
SELECT projeto.Projeto,
COALESCE(SUM(recebimento.Valor), 0) AS Total,
COALESCE(SUM(contaspagar.Valor), 0) AS Total2,
COALESCE(SUM(lnota.Valor), 0) AS Tota3
FROM projeto
LEFT JOIN recebimento ON recebimento.Projeto = projeto.IdProjeto
LEFT JOIN contaspagar ON contaspagar.Projeto = projeto.IdProjeto
LEFT JOIN lnota ON lnota.Projeto = projeto.IdProjeto
GROUP BY projeto.Projeto
We need the structure of the tables, contained data and expected result with this data.
– Sorack