Marty Marty - 1 year ago 133
HTML Question

MySQL select records 1 hour ago or fresher on datetime column

Hi I need help with a database MySQL query.

What where clause can I use to select records that are one hour ago or fresher using a


Answer Source

Something like this? I assume an DATETIME timestamp is an DATETIME field.

SELECT * FROM table WHERE datetimefield >= DATE_SUB(NOW(), INTERVAL 1 HOUR)

For more information check MySQL's date/time functions.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download