Double bookings

ICTkirsten

Registered User.
Local time
Today, 22:15
Joined
Jan 3, 2015
Messages
137
Hello,

Im trying to follow this guide but i dont understand how to do some stuff which i will underline... also how do i subtract one from the other?

Although the idea of the query - to find available slots on a given day - sounds quite simple, it's not as easy as it first appears. This is because you're looking not just for bookings that don't exist, but bookings that don't exist on a particular day. My solution, therefore, uses two queries - one that finds the appointments that have been made for a particular doctor on a given day (straightforward enough), and then a second one that effectively subtracts these from the complete list of available slots (i.e. those in tbl_available), to give the available appointments for the chosen day




thank you :)
 
Sounds like you don't want the answer but a hint, so here you go:

I'd do this in 3 queries:

A = all doctors appointments.
B = all possible appointments.
C = B - A

I think you said you had a handle on A. B is probably going to be a cartesian product (http://en.wikipedia.org/wiki/Cartesian_product) and C is going to be a LEFT JOIN from B to A (include all from B, only those in A that match).

B is the key to this. If you need more of a hint let me know.
 
Hiya sorry i do not understand any of that haha

please could you bare with me and make it clearer for me hehe
 
My solution, therefore, uses two queries - one that finds the appointments that have been made for a particular doctor on a given day

its mainly this bit that i dont get
 
Can you post your database?
 

Users who are viewing this thread

Back
Top Bottom