Hello all,
I need to delete records from a table in a MySQL database that are more than 700 days old.
There is a column with the time of the record's entry "pPostDate" , & the dates are in RFC 2822 Format... the column's format is VARCHAR, not date or datetime.
The date record looks like this... Sun, 08 May 2011 14:21:50 +0000.
I have tried a bunch of crap (MySQL, or databases of any kind are not my strongest point)
Here are a few queries I have tried:
I know that the queries do not include delete statements... I do not want to mess with that function until I am able to successfully access/return the records to delete.
Any help is greatly appreciated.
I need to delete records from a table in a MySQL database that are more than 700 days old.
There is a column with the time of the record's entry "pPostDate" , & the dates are in RFC 2822 Format... the column's format is VARCHAR, not date or datetime.
The date record looks like this... Sun, 08 May 2011 14:21:50 +0000.
I have tried a bunch of crap (MySQL, or databases of any kind are not my strongest point)
Here are a few queries I have tried:
Code:
SELECT * FROM cu_info.pi_search WHERE pPostDate BETWEEN DATE_FORMAT(NOW(),'%a, %m %b %Y %T %z') AND DATE_SUB(DATE_FORMAT(NOW(),'%a, %m %b %Y %T %z'), INTERVAL 700 DAY); SELECT * FROM cu_info.pi_search WHERE DATE_SUB(pPostDate, INTERVAL 700 DAY); SELECT * FROM cu_info.pi_search WHERE DATE_SUB(DATE_FORMAT(pPostDate,'%a, %m %b %Y %T %z'), INTERVAL 700 DAY);
Any help is greatly appreciated.
Comment