Please look at my books
table:
books
+-----+----------+------------+------------+
| id | venue_id | from_date | to_date |
+-----+----------+------------+------------+
| 1 | 8 | 2015-07-21 | 2015-07-28 |
| 2 | 5 | 2015-08-03 | 2015-08-25 |
+-----+----------+------------+------------+
I want to view all dates between from_date
and to_date
for which venue_id
= 8
My output should be:
Array
(
[0] => Array
(
[id] => 1
[venue_id] => 8
[today] => 2015-07-21
)
[1] => Array
(
[id] => 1
[venue_id] => 8
[today] => 2015-07-22
)
[2] => Array
(
[id] => 1
[venue_id] => 8
[today] => 2015-07-23
)
[3] => Array
(
[id] => 1
[venue_id] => 8
[today] => 2015-07-24
)
[4] => Array
(
[id] => 1
[venue_id] => 8
[today] => 2015-07-25
)
[5] => Array
(
[id] => 1
[venue_id] => 8
[today] => 2015-07-26
)
[6] => Array
(
[id] => 1
[venue_id] => 8
[today] => 2015-07-27
)
)
today
calculates from from_date
date to to_date
date. But my mind is blank about that query. How to write a MySQL query to get output like the output shown above?