MySQL select records 1 hour ago or fresher on datetime column

前端 未结 1 347
遥遥无期
遥遥无期 2021-01-14 08:40

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 DATETIME timestamp?

相关标签:
1条回答
  • 2021-01-14 09:35

    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 讨论(0)
提交回复
热议问题