1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How delete post older than x and shorter than y??

Discussion in 'MySQL' started by sikec, Dec 19, 2012.

  1. #1
    I have large database with posts of Wordpress. I mean over 500 000 rows. And I would like to DELETE rows, in where are posts


    shorter than 50 characters and older than 60 days. (both contitions have to be realize together).


    The CODE is only my experiment, how it do....

    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 :confused:
     
    sikec, Dec 19, 2012 IP
  2. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #2
    Let's see the actual DELETE statement that's not working. (I'm assuming that the SELECT statement actually returns something.) The only difference is that you replace

    SELECT *

    with

    DELETE

    (no *).
     
    Rukbat, Dec 20, 2012 IP