Subject Re: [ib-support] Delete from two tables at once
Author Martijn Tonies
Is there a foreign key relation from B to A? If so, why not create
it with CASCADE DELETE?


With regards,

Martijn Tonies
Database Workbench - the developer tool for InterBase & Firebird
Upscene Productions
http://www.upscene.com

See you at the First European Firebird Conference in May in Fulda, Germany
http://www.firebird-conference.com

> I have to tables (A and B), and I want to delete records from both of
> them that exist in both of them. If a record exists in only one, then
> I don't want to delete it.
>
> This would be the easiest way to do it:
>
> delete from A where id in (select id from B)
>
> The problem is that after I delete them table A, I loose my record of
> what to delete from B, so I can't follow up with:
>
> delete from B where id in (select id from A)
>
> as the records have already gone.
>
> Any suggestions?
>
> Robert Munro
>
>
>
>
> To unsubscribe from this group, send an email to:
> ib-support-unsubscribe@egroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>