have you any sql query,which remove my 2 month old links ....

Discussion in 'Databases' started by milan202, Jun 28, 2010.

  1. #1
    Hello Every one...

    I am running one large database site. suddenly my sql loads highly on server, and two-three times, my host have suspend me. now I wanted to delete my old links which are more then 2 month...I am very thank full if any sql master or php coder can give me that type of query...
     
    milan202, Jun 28, 2010 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    Can you post the structure of the table?
     
    jestep, Jun 28, 2010 IP
  3. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #3
    It would be something like:

    DELETE FROM my_table WHERE date_column <= DATE_SUB(NOW(), INTERVAL 2 MONTHS);
     
    jestep, Jun 28, 2010 IP
  4. milan202

    milan202 Peon

    Messages:
    104
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I have included here image of my table structure..........please look at this and give your answer.....
     

    Attached Files:

    milan202, Jun 28, 2010 IP
  5. tnrsr

    tnrsr Peon

    Messages:
    14
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Delete From pligg_links Where link_published_date < Date_Sub(Curdate(), Interval 2 Months);
     
    tnrsr, Jul 2, 2010 IP