I had a question up earlier and it was pretty much solved expect one part of it. for some reason its not showing me between dates for my query. Just the dates that i enter in the parameter. i was wondering if anyone can see any problem with the code. Any help is much appreciated.
SELECT *
FROM Vehicles
WHERE Vehicles.vehicle_id NOT IN (
SELECT Booking.[vehicle id]
FROM Booking
WHERE (
[Enter Start Date] BETWEEN booking.start_rent_date
AND booking.end_rent_date
)
OR (
[Enter End Date] BETWEEN booking.start_rent_date
AND booking.end_rent_date
)
);
It's supposed that [Enter End Date] is greater than [Enter Start Date].
First, try if this single query works fine:
SELECT Booking.*
FROM Booking
WHERE (((Booking.start_rent_date)>#2016/11/1#)
AND ((Booking.end_rent_date)<#2016/11/20#));
Second, try to join with distinct values:
SELECT *
FROM Vehicles
WHERE Vehicles.vehicle_id NOT IN
(
SELECT distinct Booking.[vehicle id]
FROM Booking
WHERE (((Booking.start_rent_date)>#2016/11/1#)
AND ((Booking.end_rent_date)<#2016/11/20#))
);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.