On Oct 17, 2006, at 1:41 PM, Youri wrote:


Norman,


The thing is that I have thought of 2 options :

Let's say that I have a APPTS_TBL with :

ID_Appts, id_patient, id_doctor, Date, Time_start, Time_finish

1 - Clever one :

I only create a record in the Table when an appointment is made. I need to find a SQL statement that could perform the search of "non presence of record"... Not sure if possible. The query needs to find the "holes" and propose a solution to the user.

2 - Brute force one :

At the start I create 1 year of empty records with slots of 15 mins. Every day or week I create the additional day required to have a year in advance in my Table. Thus, when an appointment is made I just fill in the appropriate record. The SQL query is quite simple there. This solution lacks of elegance.

That's where I am so far, and I'm quite stuck with these 2 structures.

Any better/clever idea?

You could query for any data where the time difference between the current and next record is more than the length of your appointment

Do your doctors book in 15 minute increments ?

If so you could predefine all "available" times, and when an appointment is booked then remove those that are "used"
Cancelling returns those times to the pool
Then it's a quick query to find a block of time long enough for your appointment

        

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to