Re: Scheduled events

2007-08-15 Thread Warren Young
Beauford wrote: Is there a way to run the following command via cron. $ man mysql -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: Scheduled events

2007-08-14 Thread Baron Schwartz
Beauford wrote: delete from contacts where TO_DAYS(CURDATE()) - TO_DAYS(today) >= 30 and status != "Y"; Off-topic: you're defeating indexes with TO_DAYS(). If there's an index on the 'today' column, this will be able to use it: ... where today <= date_sub(current_date, interval 30 day)...

Re: Scheduled events

2007-08-14 Thread Dan Buettner
It's a database, not a scripting language ... :) You can run a simple cron entry like this: 0 4 * * * /path/to/mysql -u USER -pPASS -D DATABASE -e "delete from contacts where TO_DAYS(CURDATE()) - TO_DAYS(today) >= 30 and status != 'Y';" so at 4 AM each day your SQL would be executed. For long S

RE: Scheduled events

2007-08-14 Thread Beauford
> > I have been trying for days to find a simple command in > MySQL where I > > can automatically delete records based on some criteria after a > > certain timeframe. > > > > I found this in the MySQL manual, but I guess it only works with > > version 5.1+. Unfortunately the version I need thi

Re: Scheduled events

2007-08-14 Thread Baron Schwartz
Hi, Beauford wrote: Hi, I have been trying for days to find a simple command in MySQL where I can automatically delete records based on some criteria after a certain timeframe. I found this in the MySQL manual, but I guess it only works with version 5.1+. Unfortunately the version I need this

Scheduled events

2007-08-14 Thread Beauford
Hi, I have been trying for days to find a simple command in MySQL where I can automatically delete records based on some criteria after a certain timeframe. I found this in the MySQL manual, but I guess it only works with version 5.1+. Unfortunately the version I need this to work on is 4.1, and