From: Baron Schwartz Date: August 14 2007 11:55pm Subject: Re: Scheduled events List-Archive: http://lists.mysql.com/mysql/208573 Message-Id: <46C24106.9050106@xaprb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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)... MySQL can't use an index on a column if the column is part of an expression (generally speaking). Baron