sql - MySQL. Issue with: INTERVAL 60 MINUTES + last_run < NOW() -
i attempting select row database based on time value.
my database contains table of actions. these actions run ever x number of minutes. when action ran, row updated , it's last_run
column timestamp
containing value of now()
here valid row in database. can see row last run days ago. it's set run every 60 minutes.
i use interval last_run + interval_minutes < now()
. so, last run time, plus sixty minutes, less value of now()
if 60 minutes has passed.
the query trying run below:
select * routine_actions routine_actions.routine_id = 12 , interval routine_actions.interval_minutes minute + routine_actions.last_run < now() group routine_id
but, i'm getting no results. idea's doing wrong?
the query you're trying looks ok in first part of question, following
interval last_run + interval_minutes minutes < now()
should be
interval interval_minutes minutes + last_run < now()
Comments
Post a Comment