RE: Reservation technique

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Great! Thanks Murray.

Hi Roger,

On second thoughts, perhaps the BETWEEN operator isn't what you're looking
for, since it will probably return false matches on bordering reservations.

In other words, someone attempting to make a reservation between 10am and
12pm might be told there's a conflicting reservation if there is already a
reservation for between, for example, 12pm and 2pm on the same day. The end
time of 12pm on the new reservation will return a match for the start time
of 12pm on the existing reservation using the BETWEEN operator.

As an alternative, you might try something like:

SELECT * FROM reservation_table WHERE (new_start_datetime >
reservation_start_datetime AND new_start_datetime <
reservation_end_datetime) OR (new_end_datetime > reservation_start_datetime
AND new_end_datetime < reservation_end_datetime)

This should exclude false matches on bordering reservations.

Much warmth,

Murray
http://www.planetthoughtful.org
Building a thoughtful planet,
One quirky comment at a time.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux