I am trying to get all records that are 2 hours or older using this query
$minutes = 60 * 2
SELECT COUNT(id) AS TOTAL, job_id
from tlb_stats
WHERE log_time >= DATE_SUB(CURRENT_DATE, INTERVAL $minutes MINUTE)
GROUP BY job_id
He selects only the latest entries and skips the old ones. When I change log_time <=, it selects only the old and skips that are new.
What am I doing wrong?
source
share