MySql Query to delete all rows with DATE less than

Posted on 2011-10-21
Last Modified: 2012-05-12

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

Question by:Fernanditos
    1 Comment
    LVL 19

    Accepted Solution

    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Suggested Solutions

    Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
    Part of the Global Positioning System A geocode ( is the major subset of a GPS coordinate (, the other parts being the altitude and t…
    The viewer will learn how to count occurrences of each item in an array.
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now