I need to make an SP that allows me to show for a certain hotel and in a range of dates, the number of free rooms and the number of rooms occupied. Then I have to group them by date and category. I have the tables: Hotel, Reservations, Category and Occupation. So far I have only the quantities of free and occupied rooms
select SUM(Cantidad_ocupantes) as 'Habitaciones ocupadas',
(select COUNT(Cantidad_ocupantes) from Ocupacion where Cantidad_ocupantes=0) as 'Habitaciones Libres'
from Ocupacion
I appreciate all the ideas that come my way.