this is my first question so forgive me if I am doing this wrong. I have been trying to think up a query for the above described problem and I can't seem to get anywhere.
SELECT SUM(slots) AS totals,date
FROM
(
SELECT start, end, date, slots
FROM 1000_appointments
WHERE date > NOW() AND HOUR(end) <= 12 AND employeeID='1000001'
) q
GROUP BY date HAVING totals < 6
This gets me the days where the total of slots is less than 6 and that is great but I also need all rows for that date and, if at all possible, dates that have no entries in the table. I could possible do the sorting and listing in php but I figured there might be a more elegant way of doing this within mysql.
I hope this describes the problem well enough. The reasoning behind this is that I need to find dates where "slots" are still available ie dates that aren't booked out.
Thank you, for your help in advance.