0
I’m doing a college paper on databases, and one of the Query
what I must do is this:
- Show all creditors who had a larger purchase total than that R$ 5000,00;
I tried to:
SELECT NomeCredor, SUM(Compras.Valor)
FROM Credores, Compras
WHERE (idCredores = Compras.Credores_idCredores)
AND (SUM(Compras.Valor)) > 5000
GROUP BY NomeCredor
ORDER BY NomeCredor;
The problem is that the SUM(Compras.Valor)
cannot be passed as a condition of WHERE
. Does anyone know an alternative?
Good John, I believe your answer is correct!
– Marconi
It worked! Thank you very much. I will read about the HAVING clause.
– Adauto Pinheiro