im trying to show elements reserved between two separate date columns (start and end dates). I want to search between dates, but the query seems to ignore any dates that are between the selected dates.
SELECT
bookings.booking_id,
bookings.booking_id,
bookings.booked_from,
bookings.booked_from,
bookings.booked_till,
item_set_computer.item_id,
item_set_computer.name,
item_set_computer.booking_groups_id
FROM
bookings,
item_set_computer
WHERE
item_set_computer.item_id = bookings.item_id
AND
item_set_computer.booking_groups_id = 3
AND
booked_from
BETWEEN "2010-04-13" AND "2010-04-20"
AND
booked_till
BETWEEN "2010-04-13" AND "2010-04-20"
For example, I have an item ordered from the 13th to the 15th. date1 is 2010-04-13, and date2 is 2010-04-15. The user searches for booked items from 14 to 16. He does not return any results. Why does it ignore database dates that fall between dates selected by the user? Columns are set as DATE in the database and entered correctly.
source
share