D
Debbie D.
Time Schedule Query
I have database, the purpose of which is for students to book a date and
time for a test. Tests can only be taken at the following days/times and
last 45mins:
Mondays: 11:30 to 12:30 and 12:30 to 13:30
Thursdays: 17:00 to 18:00, 18:00 to 19:00 and 19:00 to 20:00
There are 12 computers which can be booked. As a further compaction all of
these PC can either perform a full test or a primer version of the test. A
form takes the bookings and stores them in a table named: TestAppointments
the structure of which is:
[TestAppointments]
ApptDate, (Date/Time) (composite primary)
AppTime (Number Lg Int) ?? (composite primary)
TestMode (Text size 10 composite primary) coming from a combo on a form for
either Test/Primer)
WorkStationID (Number Lg Int) (composite primary)
StudentID (Number Lg Int) related through a students table storing relevant
info, the many side of a 1-m. Also indexed unique)
The above table will not allow a student to mistakably be booked on either a
test or primer at the same time/date slot.
Through kind information provided by this board the following was then
undertaken.
The above table only stores booked information regarding dates, times, PC
and a test or primer version etc. and through a combo box the fact whether
the PC and its time slot is being used for either a Test or Primer. This
table then generates a reporting giving full daily details of the usage of
the room.
The problem was after this to create a query that would list any vacant time
slots for future booking details with the available time slots and
WorkStationIDs. Another table was introduced that details a full 12 months
of availability as follows:
[YearlySchedule]
Date (Date/Time composite key)
WorkStationID (Number Lg Int composite key)
TestMode (text size 10 (test or primer composite key)
TestTime (Date/Time composite key)
StudentID (Num Lg Int not used not related??)
Something that just bugs me, shouldn’t I be relating the
[TestAppointments.StudentID] > [YearlySchedule.StudentID] if so how? All
these composite primary keys give me interminate when trying to join. And
will I now nearly to change the type of the [TestAppointments.ApptTime] to
match the YearlySchedule.TestTime] for the following query to work
correctly?? In the YearlySchedule table there are now correct 4008 available
testing/primer time slots available.
A kind member then assisted me with the following SQL:
SELECT YearlySchedule.Date, YearlySchedule.TestTime,
YearlySchedule.WorkStationID, TestAppointments.ApptDate
FROM YearlySchedule LEFT JOIN TestAppointments ON YearlySchedule.Date =
TestAppointments.ApptDate
WHERE (((TestAppointments.ApptDate) Is Null));
And it worked perfectly when querying an empty TestAppointements table.
However if I put just one single appointment in there i.e. 12 Sept 2005
(which should approximately 59 free that day) the number drops to some like
3948 which is taking all the available day slots for just one time slot and
then continues showing all the next days henceforth as free.
Soo sorry to dragging this on but I’ve been 4 days at this keyboard. Many
thanks for taking the time to read this, any help appreciated.
Debbie D.
I have database, the purpose of which is for students to book a date and
time for a test. Tests can only be taken at the following days/times and
last 45mins:
Mondays: 11:30 to 12:30 and 12:30 to 13:30
Thursdays: 17:00 to 18:00, 18:00 to 19:00 and 19:00 to 20:00
There are 12 computers which can be booked. As a further compaction all of
these PC can either perform a full test or a primer version of the test. A
form takes the bookings and stores them in a table named: TestAppointments
the structure of which is:
[TestAppointments]
ApptDate, (Date/Time) (composite primary)
AppTime (Number Lg Int) ?? (composite primary)
TestMode (Text size 10 composite primary) coming from a combo on a form for
either Test/Primer)
WorkStationID (Number Lg Int) (composite primary)
StudentID (Number Lg Int) related through a students table storing relevant
info, the many side of a 1-m. Also indexed unique)
The above table will not allow a student to mistakably be booked on either a
test or primer at the same time/date slot.
Through kind information provided by this board the following was then
undertaken.
The above table only stores booked information regarding dates, times, PC
and a test or primer version etc. and through a combo box the fact whether
the PC and its time slot is being used for either a Test or Primer. This
table then generates a reporting giving full daily details of the usage of
the room.
The problem was after this to create a query that would list any vacant time
slots for future booking details with the available time slots and
WorkStationIDs. Another table was introduced that details a full 12 months
of availability as follows:
[YearlySchedule]
Date (Date/Time composite key)
WorkStationID (Number Lg Int composite key)
TestMode (text size 10 (test or primer composite key)
TestTime (Date/Time composite key)
StudentID (Num Lg Int not used not related??)
Something that just bugs me, shouldn’t I be relating the
[TestAppointments.StudentID] > [YearlySchedule.StudentID] if so how? All
these composite primary keys give me interminate when trying to join. And
will I now nearly to change the type of the [TestAppointments.ApptTime] to
match the YearlySchedule.TestTime] for the following query to work
correctly?? In the YearlySchedule table there are now correct 4008 available
testing/primer time slots available.
A kind member then assisted me with the following SQL:
SELECT YearlySchedule.Date, YearlySchedule.TestTime,
YearlySchedule.WorkStationID, TestAppointments.ApptDate
FROM YearlySchedule LEFT JOIN TestAppointments ON YearlySchedule.Date =
TestAppointments.ApptDate
WHERE (((TestAppointments.ApptDate) Is Null));
And it worked perfectly when querying an empty TestAppointements table.
However if I put just one single appointment in there i.e. 12 Sept 2005
(which should approximately 59 free that day) the number drops to some like
3948 which is taking all the available day slots for just one time slot and
then continues showing all the next days henceforth as free.
Soo sorry to dragging this on but I’ve been 4 days at this keyboard. Many
thanks for taking the time to read this, any help appreciated.
Debbie D.