I have a problem with my MySQL Query but despite the amount of searching I can't seem to find an answer.
I have a table that records data for something. It gets updated every 2 minutes by a cron job. When the data is intially input into the table the 'date' field is as follows:
0000-00-00 00:00:00
And then every time it gets updated it the NOW() function is used and so outputs as follows:
2011-07-07 15:44:02
Then when the object being recorded goes offline the data then gets filed away in a different table. The problem is that I cannot seem to write a successful query to select rows where the 'date' field has not been updated for 10 minutes.
The current query I have is below; (it seems to file the row but only after several hours. I have checked the time zone as I suspected that is likely to be causing the problem however, the NOW() query is run from the same PHP file as the query below, so that can't be the problem.
SELECT * FROM data WHERE check_active = '1' AND check_recorded = '0' AND takeoff = '1' AND callsign != '' AND `date` < DATE_SUB( NOW() , INTERVAL 10 MINUTE )
Any help is greatly appreciated.