Hello....
I need to find all the matches in a table between 2 specific dates. For example, on each date, a certain airplane may be available for hire. But there are 4 airplanes. So on any date, there could be 4 planes available. Sometimes 1 or 2 of them are booked and not available.
What i would like is to do a query, between 2 date ranges, and find only those airplanes available for all the days (say someone wants to go on a 5 day trips).
What I have, but isn't working is this:
SELECT distinct t.tid
FROM dates d,types t,planes p
WHERE p.oid=d.oid
AND d.timestamp>$start_day
AND d.timestamp<$end_day
AND p.oid=$flight_school_id
AND t.max_persons>=$max_people
AND d.tid=t.tid
GROUP BY (t.tid) HAVING count(*) >= $nights
ORDER BY d.timestamp ASC";
Any help would be appreciated.
Thanks,
-dr