开发者

MySQL select records 1 hour ago or fresher on datetime column

开发者 https://www.devze.com 2023-03-11 00:21 出处:网络
What where clause can I use to select records that are one hour ago or fresher using a DATETIME time开发者_运维百科stamp?Something like this? I assume an DATETIME timestamp is an DATETIME field.

What where clause can I use to select records that are one hour ago or fresher using a DATETIME time开发者_运维百科stamp?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号