I am trying to count the number of bookings for the next 7 days with the following query.
select calendarDate,
(
select COUNT(*)
FROM isBooked INNER JOIN booking
ON isbooked.BookingID = booking.bookingID
where specificday between booking.startDate and booking.endDate
)
from calendar as specificday
where calendardate between '2015-08-23' and DATE_ADD('2015-08-23', INTERVAL 6 DAY);
I have used SQL server which allows the use of 'as specificday' however MySQL does not, how would i rewrite the query in mysql.