MySQL INTERVAL Mins

SELECT * FROM `table_name` WHERE CURTIME() >= (`colname` + INTERVAL 120 MINUTE)

Here, colname is the column where you added timestamp at the time when the record was created.


Try:

$minutes = 60 * 2

SELECT COUNT(`id`) AS `TOTAL`, `job_id` 
  FROM `tlb_stats` 
  WHERE `log_time` < DATE_SUB(NOW(), INTERVAL $minutes MINUTE) 
  GROUP BY `job_id`
  • use backticks to quote fields (words like "total" and "id" may someday mean something in MySQL)
  • use NOW() for CURRENT_DATE just means 2010-08-04, not including the time
  • use < to get entries older than that date.