I have a database for hotel reservation with tables: room, customer, reservation (id, id_room, id_customer_ arrive_date, departure_date, ...).
When I select a room in my app I need to view a calendar widget with days red colored if in that day the room is busy.
I need a way to retrieve a list of busy days for a room,month,year combination.
My idea is to create a new table from previous with columns: date,day,month,year,room,is_busy and then query it.
SELECT day FROM new_table WHERE month=m AND year=y AND room=r AND is_busy=1
The problem is to update the new table every time.
Is there a simple way?