Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2012
    Posts
    4

    Question Unanswered: How delete post older than x and shorter than y??

    Hi guys,
    How delete post older than x and shorter than y? It is in Wordpres MySQL database. I´ve tried:
    SELECT *
    FROM `wp_posts`
    WHERE `post_type` = 'post'
    AND DATEDIFF( NOW( ) , `post_date` ) >350
    AND LENGTH( `post_content` ) <50

    so SELECT is for selecting, I use than DELETE...

    but it is not working. Whats is wrong? Thanks a lot. Peter

    PS: I am newbie...sorry

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    is your select statement selectign the records you want?
    if so replace the SELECT * with DELETE

    Code:
    DELETE FROM 'wp_posts'
    WHERE 'post_type' = 'post'
    AND DATEDIFF( NOW( ) , 'post_date' ) >350
    AND LENGTH( 'post_content' ) <50
    to be honest I'm not certain if the backtick (`) is an issue but I tend to use '
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Dec 2012
    Posts
    4
    Thank a lot, it is OK...Petr

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •