On Thu, 2008-08-07 at 09:14 -0700, felix@crowfix.com wrote:
> DELETE FROM a WHERE a.b_id = b.id AND b.second_id = ?
>
This should work for your needs:
delete from a
using b
where a.id = b.id -- join criteria
and b.second_id = ?
> I have tried to do this before and always found a way, usually
> DELETE FROM a WHERE a.b_id IN (SELECT id FROM b WHERE second_id
> = ?)
This is akin to:
delete from a
where (a.key1, a.key2, a.key3) in (select key1, key2, key3 from b)
I use this every day for millions of rows per delete and it works just
fine and in a very reasonable time period.
-Mark