Hi everyone,
Just having a mental block here and I wonder if you could help me out?
I am writing a library app, very simple, and we are allowing users to
book out an item by selecting 2 dates (startDate and endDate). My
problem is the query to check if the dates they selected are
available.
I need to make sure the startDate isnt in between any existing
bookings start and end date, the same with the endDate. Also make
sure that the users startDate andendDate arent eclipsing any one elses
bookings.
Now I think I started on the right track, but something aint right:
SELECT *
FROM LibraryBooking
WHERE lib_item = #attributes.lii_id#
AND (
(lib_StartDate >= #startDate# AND lib_StartDate <= #startDate#)
OR
(lib_EndDate >= #endDate# AND lib_EndDate <= #endDate#)
)
Thanks in advance!
Duncan
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application
http://www.houseoffusion.com/banners/view.cfm?bannerid=48
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189312
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54