I’m struggling to make this work, this query should give the deal with the cheapest price between two dates but somehow it’s giving the cheapest offer always and it kinda ignores the date
SELECT offer_id
FROM travel_offers o
WHERE price = (
SELECT MIN(price) as minprice
FROM travel_offers om
WHERE
o.latitude = om.latitude AND
o.longitude = om.longitude AND
(o.time_from BETWEEN '2012-07-01' AND '2012-11-31')
AND
(o.time_to BETWEEN '2012-07-01' AND '2012-11-31')
)
1 Answer