I have a table that looks like this
id | refreshTime | lastRanAt | otherFeilds
1 | 60 | 2012-05-14 14:25:08 | somthing
2 | 30 | 2012-05-14 15:25:08 | something else
3 | 20 | 2012-05-03 16:25:08 | foo
I would like to return results where the ‘lastRanAt’ datetime is less than the currentTime minus the refreshTime (the refreshTime is in minutes)
Can this be done in one query?
Thanks in advance
Something like this?
SQL Fiddle