0
Why not use the GROUPBY thus:
SELECT
conta_idconta, SUM(valor) AS ValorTotal
FROM
contaSaida
WHERE
conta_empresa_idempresa=1 AND conta_subcategoria_idsubcategoria=4 AND data BETWEEN '2017-03-06' AND '2018-03-06'
GROUP BY
conta_idconta
I tried to use your command above and returned nothing!
– GustavoSevero
I want you to show the data separately and the sum of the respective values.
– GustavoSevero
As it is not being returned, there is a problem in the condition of the survey, only seeing the contents of the table to know...
– Paulo R. F. Amorim
You need to know if there is any data that matches that filter (Where). If you select without the
DISTINCT
and without theSUM
returns some value?– Alexandre Cavaloti
@Paulor.F.Amorin, follow the chart content print in the description. I just posted. Thanks.
– GustavoSevero
I saw now that the dates were not between simple quotes, maybe this link can explain better link
– Paulo R. F. Amorim
Sorry, I didn’t understand what you meant about the simple quotes. I circled your sql code with the simple quotes and it didn’t work. In the link you gave me, in the example, he must have mounted the command in the editor, because when you put a field he puts in simple quotes, normal.
– GustavoSevero
@Paulor.F.Amorin, got it, the problem was my query that was with the dates without simple quotes. Thanks.
– GustavoSevero