Z
zakhan
I have a table with the following structure:
BookingId StaffId MemberId BookingDate BookingFrom BookingTo Cancelled
117 14 2025 2/8/2005 10:00:00 AM 10:30:00 AM No
118 14 2025 2/8/2005 8:30:00 AM 9:00:00 AM No
119 14 2025 2/8/2005 9:00:00 AM 9:30:00 AM No
Now I have a query:
SELECT *
FROM Bookings
WHERE StaffID='14'
And BookingDate=#2/8/2005#
And ((#12/30/1899 8:0:0# Between BookingFrom And BookingTo) Or
(#12/30/1899 8:30:0# Between BookingFrom And BookingTo))
And (#12/30/1899 8:30:0#<>BookingFrom)
And (#12/30/1899 8:0:0#<>BookingTo)
And Not (Cancelled=True);
This query returns the row with BookingId=118. For the life of me I
cannot figure out why this is happening. Conceptually, the table
contains a bunch of booking appointments. The query will give me a list
of conflicting appointments for a specific prospective appointment.
So basically I'm trying to see if there are any booking conflicts for
the 8-8:30 time slot and I expect this query to return no rows but it
returns 1 row which is the time-slot 8:30-9am
Shouldn't the AND condition 'And (#12/30/1899 8:30:0#<>BookingFrom)'
return FALSE causing the query to return zero rows?
Simple enough as this might seem, I just can't get this to work.
(I have an .mdb file with the table and query if anyone would like the
table and query).
Thanks.
BookingId StaffId MemberId BookingDate BookingFrom BookingTo Cancelled
117 14 2025 2/8/2005 10:00:00 AM 10:30:00 AM No
118 14 2025 2/8/2005 8:30:00 AM 9:00:00 AM No
119 14 2025 2/8/2005 9:00:00 AM 9:30:00 AM No
Now I have a query:
SELECT *
FROM Bookings
WHERE StaffID='14'
And BookingDate=#2/8/2005#
And ((#12/30/1899 8:0:0# Between BookingFrom And BookingTo) Or
(#12/30/1899 8:30:0# Between BookingFrom And BookingTo))
And (#12/30/1899 8:30:0#<>BookingFrom)
And (#12/30/1899 8:0:0#<>BookingTo)
And Not (Cancelled=True);
This query returns the row with BookingId=118. For the life of me I
cannot figure out why this is happening. Conceptually, the table
contains a bunch of booking appointments. The query will give me a list
of conflicting appointments for a specific prospective appointment.
So basically I'm trying to see if there are any booking conflicts for
the 8-8:30 time slot and I expect this query to return no rows but it
returns 1 row which is the time-slot 8:30-9am
Shouldn't the AND condition 'And (#12/30/1899 8:30:0#<>BookingFrom)'
return FALSE causing the query to return zero rows?
Simple enough as this might seem, I just can't get this to work.
(I have an .mdb file with the table and query if anyone would like the
table and query).
Thanks.