On Apr 13, 2004, at 6:01 PM, Charles Sprickman wrote:
DELETE FROM vlog WHERE timestamp < DATE_SUB(CURRENT_DATE, INTERVAL 7
DAY)

On 5.3.x, timestamp is in unix timestamp format, so you'll need something
like "DELETE FROM vlog WHERE timestamp <
unixtime_where_you_want_to_delete_from".


Is using a MySQL DATETIME type new in 5.4.x?

My mistake. I was taking code from something else.


Perhaps this would work better:

DELETE FROM vlog WHERE timestamp < (UNIX_TIMESTAMP() - (7 * 24 * 60 * 60))

Replace the 7 with the number of days of entries you want to keep.

This is totally untested, and based on documentation I just read at dev.mysql.com.

--
Tom Collins  -  [EMAIL PROTECTED]
QmailAdmin: http://qmailadmin.sf.net/  Vpopmail: http://vpopmail.sf.net/
Info on the Sniffter hand-held Network Tester: http://sniffter.com/



Reply via email to