On 21 Jan 2011, at 10:26, Alvaro Carrasco wrote:

> 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 )

Thanks, the subquery and MAX() is what I needed.

Here's my query:

DELETE 
FROM table 
WHERE fk=' . $fk . ' AND created <> (SELECT MAX(created) FROM table WHERE fk=' 
. $fk . ')


_______________________________________________

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

Reply via email to