Bulk delete in MySQL

Discussion in 'MySQL' started by coba, Aug 15, 2009.

  1. #1
    Hi,

    I need to bulk delete old data from MySQL and need help on query command on date.

    Thanks for any help.
     
    coba, Aug 15, 2009 IP
  2. anhbloginc

    anhbloginc Well-Known Member

    Messages:
    1,288
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    175
    #2
    What exactly you want deleted in your database ? post ? comment ? data in table ? row ?
     
    anhbloginc, Aug 15, 2009 IP
  3. coba

    coba Peon

    Messages:
    109
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    All data related to post with specified range of date
    eg: 2008/12/01 - 2009/04/25 to be deleted
     
    coba, Aug 15, 2009 IP
  4. anhbloginc

    anhbloginc Well-Known Member

    Messages:
    1,288
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    175
    #4
    Sorry , but what do you mean by " data related " ? . It's mean a post with name like " post " + date from 2008/12/01 - 2009/04/25 , will be deleted .

    Or just want all of post have date from 2008/12/01 - 2009/04/25 will be deleted ?

    Show me !
     
    anhbloginc, Aug 15, 2009 IP
  5. anhbloginc

    anhbloginc Well-Known Member

    Messages:
    1,288
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    175
    #5
    MySQL Command :

    1. If you want deleted all post have date from 2008/12/11 - 2008/12/13 you can using :

    In this , table is table name .

    2. If you want to deleted a post have content " post " in any column and date from 2008/12/11 and 2008/12/13 , you can using this :

    Regards.
     
    anhbloginc, Aug 15, 2009 IP
    coba likes this.
  6. coba

    coba Peon

    Messages:
    109
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Yes, I need the 1st query which delete range of date but got any error as :
     
    coba, Aug 15, 2009 IP
  7. coba

    coba Peon

    Messages:
    109
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Sorry missing date table
    Working great, thanks for your great help.
     
    coba, Aug 15, 2009 IP
  8. anhbloginc

    anhbloginc Well-Known Member

    Messages:
    1,288
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    175
    #8
    No problem. I would like to help people which are member of DP . You're welcome

     
    anhbloginc, Aug 15, 2009 IP
  9. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Btw, before you randomly execute anything another user here says on this forum, it's always best to change the DELETE statement to a SELECT * and confirm that it is indeed the data you want to delete. There's no turning back from these kinds of statements otherwise :)
     
    premiumscripts, Aug 15, 2009 IP
  10. coba

    coba Peon

    Messages:
    109
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    With SELECT * statement I got a resulted as :-
    [​IMG]
    even the posts within this date is in database.
     
    coba, Aug 15, 2009 IP