<cfquery name="Booking_Link" datasource="HotelBookingSystem" username="HBSuser" password="HBSpass">
SELECT *
FROM Bookings
WHERE BookingDateIN AND BookingDateOUT NOT BETWEEN <cfqueryparam value="#FORM.SelDateIN#" cfsqltype="cf_sql_date"> AND <cfqueryparam value="#FORM.SelDateOUT#" cfsqltype="cf_sql_date">
</cfquery>
This works .... But if my booking date(UK - dd/mm/yyyy) has a range of 05/02/2010 to 09/02/2010
And my search value is 04/02/2010 to 05/02/2010 ... this don't work :(.
I can understand why so I thought of
<cfquery name="Booking_Link" datasource="HotelBookingSystem" username="HBSuser" password="HBSpass">
SELECT *
FROM Bookings
WHERE BookingDateIN AND BookingDateOUT NOT BETWEEN <cfqueryparam value="#FORM.SelDateIN#" cfsqltype="cf_sql_date"> AND <cfqueryparam value="#FORM.SelDateOUT#" cfsqltype="cf_sql_date">
AND BookingDateIN != <cfqueryparam value="#FORM.SelDateIN#" cfsqltype="cf_sql_date">
AND BookingDateOUT != <cfqueryparam value="#FORM.SelDateOUT#" cfsqltype="cf_sql_date">
</cfquery>
But this doesn't work :(, So is there another way of doing this ?
I have tried the >= and <= way as well , but that also has problems.