I have a proprietary table with customer data and another advance payment that is a table that stores information about the payments of the same. At the time of making a query to obtain and show (if the sum of all the payments of the month exceeds $ 200) this error occurs to me. Who will be so kind to guide me, not with the resolution as such, but rather so that I can understand the concept of the functions and recognize the way of thinking correctly. Thank you.
SELECT nombre, apellido, fecha, SUM(montocobrado) AS TOTAL
FROM estacionamiento.propietario
INNER JOIN estacionamiento.abonoanticipado ON propietario.idPropietario=abonoanticipado.idPropietario
AND TOTAL>=200
GROUP BY propietario.DNI
The column "TOTAL" in Where Clause is unknown.