I want to find the products that do not have the date range that I pass (it will be a parameter). I was able to write this query, but it is limited because it does not consider a reservation with a previous "check in" or a later "check out".
Can you help me?
SELECT *
FROM bookings b
right join products p ON b.product_id = p.id
WHERE b.check_in_date >= '2022-11-10' AND NOT b.check_out_date <= '2022-11-25';
The output would be all products that do not have any booking with dates within the range.
