On Fri, Jan 21, 2011 at 10:23 AM, Wade Preston Shearer
<[email protected]> wrote:
>
> 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.
>

I see. In that case, you'll probably have to do a subquery on the
where clause. Something like:

delete table1 from table1
inner join table2 on table1.table2_id = table2.id
where table2.created_date <> (select max(table2.created_date) from
table1 inner join table2 on ... and so forth )

Alvaro

_______________________________________________

UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net

Reply via email to