Change this from a SELECT to a DELETE, but you should get the idea. SELECT * FROM `t1` WHERE `f_id` = 1 ORDER BY `fdate` DESC LIMIT 1,1000;
Using LIMIT to Offset the results by 1. -- Ritter On Fri, Jan 21, 2011 at 10:23 AM, Wade Preston Shearer < [email protected]> wrote: > On 21 Jan 2011, at 10:20, Alvaro Carrasco wrote: > > > Something like this should do it: > > > > delete table1 from table1 > > inner join table2 on table1.table2_id = table2.id > > where table2.created_date > '2011-01-01' > > The date is unknown though and different for each foreign key. I just need > to keep the most recent. It seems like it would need an ORDER BY and a > LIMIT. I"m putting together a test but haven't gotten that far yet. > > > _______________________________________________ > > UPHPU mailing list > [email protected] > http://uphpu.org/mailman/listinfo/uphpu > IRC: #uphpu on irc.freenode.net > _______________________________________________ UPHPU mailing list [email protected] http://uphpu.org/mailman/listinfo/uphpu IRC: #uphpu on irc.freenode.net
