Hi,
I am still having problems with trying to get my SQL statement to produce the correct results.
I have a table which holds data and within the table there is a feild named "CurrentTime" and it is a type "time". A typical entry would be "08:45:00"
I am trying to write a query that will look at the table and bring back all records where the CurrentTime is equal to NOW() time minus 30 mins plas 120 mins.
The query below does this but, and theres always a but, when the NOW() time approaches midnight no data is returned.
SELECT
ScheduledTime,
Flight,
Logo,
IATALookup,
RemarksWithTime,
Terminal,
Zone
FROM TableName
WHERE CurrentTime BETWEEN DATE_FORMAT(NOW() - INTERVAL 45 MINUTE, '%H:%i') AND DATE_FORMAT(NOW() + INTERVAL 120 MINUTE, '%H:%i') AND ArriveDepart = 'O'
AND FlightDisplay = 'Y'
ORDER BY ScheduledTime, FlightHistoryID, CodeShare ASC
I have received a lot a help "johanafm" and I would not have gotten this far without it, so johanafm, thank you for that.
Can anyone see how I can make this work.