I would like you to help me with a little doubt that I have, I need to create a view query, where I show the total sum of income for the leases in the months that I want to see, I did this but I do not know if it will work as I want
CREATE VIEW ganancias_arriendo_mes as
(
SELECT E.nombre_ed,
A.fecha_arr,
SUM(A.valor_arr) as ganancias_mes
FROM
edificio E,
vive V,
inquilinos I,
arrienda A
WHERE
V.cod_ed=E.cod_ed
AND V.rut_in=V.rut_in
AND I.rut_in=V.rut_in
GROUP BY(E.nombre_ed, A.fecha_arr)
ORDER BY(ganancias_mes)
)
select *from ganancias_arriendo_mes
WHERE fecha_arr BETWEEN 'fecha inicio' and 'fecha fin'