Re: DELETE with OuterJoin
Posted in 2006
Igo Besser wrote:
> Hi to all,
>
> as result of an app-error there are rows in the master-table are deleted but
> not the associated rows in the detail-table. In a view using an outer join I
> can see the wrong rows - but I can not delete (view).
> So I search for a construct of a delete-statment that enclose instead of the
> table-name a"select"-statment like it is used in the "create
> view"-statment.
>
> I can not find any documentation who to write this - with "try and error" I
> have not become a result ...
Igo, try this:
select a.rowid as trash
from detail_table a
left outer join master_table b
on a.key1 = b.key1 ....
where a.key1 b.key1 is null
into temp garbage;
delete from detail_table
where rowid in (select trash from garbage);
Art S. Kagel