I want to select all records that have been updated in the last 12 hours.
My database contains this field to record the time of update: lastdatetime, type = datetime
so the time updated would be recorded as: 2010-05-11 21:54:03
This is my current WHERE claus
[B]WHERE TO_DAYS( NOW( ) ) - TO_DAYS( lastdatetime ) <=1 AND DATE_FORMAT( CURRENT_TIMESTAMP( ) , '%H%i' ) - DATE_FORMAT( lastdatetime, '%H%i' ) <=720[/B]
I got this ideal from a post on dev.mysql.com. It is suppose to “filter for 1 day or less since updated. After that, it filters for 720 minutes (12 hurs) or less since updated”.