从1小时前selectSQL查询?

我有这个查询,但我想要更改date以删除所有从1小时以前根据服务器时间(或如果不可能由服务器时间发布date)的一切。 我怎么做?

DELETE FROM wp_posts WHERE post_date < '2008-06-06 19:18:00' AND post_status = 'publish' 

使用:

 DELETE FROM wp_posts WHERE post_date < DATE_SUB(NOW(), INTERVAL 1 HOUR) AND post_status = 'publish' 

参考:

  • DATE_ADD
  • DATE_SUB

甚至更简单:

 SELECT NOW() - INTERVAL 1 HOUR; 

所以查询变成:

 DELETE FROM wp_posts WHERE post_date < NOW() - INTERVAL 1 HOUR AND post_status = 'publish'