I think I'm pretty close on this query, but can't seem to crack it, and I'm not sure if I've got the most efficient approach.
I am trying to find a day where a user is not booked from a range of dates where they are booked.
Think staff scheduling. I need to find who is available to work on Tuesday, and is working on other days this week.
My query currently looks like this
SELECT employees.uid, name, date FROM employees LEFT JOIN storelocation ON employees.uid = storelocation.uid LEFT JOIN schedule ON emplyees.uid = schedule.uid WHERE slid =9308 AND date BETWEEN '2009-11-10' AND '2009-12-20' AND NOT EXISTS ( SELECT uid FROM schedule WHERE date = '2009-11-11' )
If I don't include the 'Not Exists', I get 1500 results If I use only the Select form the 'Not Exists', I get 200 results, so both of those queries work independently. However, my query as I've written it returns 0 results.