[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 521
  • Last Modified:

MySql Query to delete all rows with DATE less than

Hi,

Wordpress database. Table "wp_posts"

the post_date column values looks like: "2011-10-21 14:49:39"

I want to delete all posts with DATE older than 2011-10-18

How would be this query ?

Please help
Thank you

0
Fernanditos
Asked:
Fernanditos
1 Solution
 
xtermCommented:
DELETE FROM wp_posts WHERE post_date_column < "2011-10-18 00:00:00";

This will only work if post_date_column field is an actual DATE/TIME field though, so first run

DESC wp_posts;

And then make sure you've got the right field type.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now