here's my data structure:
seasons
id from to name
----------------------------------------
1 2015-11-01 2015-12-15 season1
2 2015-12-16 2015-12-30 season2
3 2015-12-31 2016-01-20 season3
rooms_free
id from to room_id
----------------------------------------
1 2015-11-26 2015-11-30 1
2 2015-12-19 2015-12-28 2
3 2015-12-22 2015-12-29 3
i need an sql query which will join both tables by date range returning the following result:
id_room room_from room_to season_id season_name
-------------------------------------------------------------
1 2015-11-26 2015-11-30 1 season1
2 2015-12-19 2015-12-28 2 season2
3 2015-12-22 2015-12-29 2 season2
could this be done using normal statements or would i need a mysql function? any ideas?
ps: the really tricky part is when there's several seasons per room ..