Re: Simple Delete Gets Complex..any Ideas
Posted in 1997
Topics: SQL Development & Query Writing
John C. Pugh wrote:
>
> Objective:
>
> Deleting rows from table "Table_A" based on results of a subquery
> which
> requires an additional table "Table_B".
>
> current syntax:
>
> Delete from Table_A where>
> (select * from Table_A, Table_B where
> Table_A.PK = Table_B.FK (+))
>
> needless to say this doesn't work, I also attempted the following
>
> Delete from Table_A where
> EXISTS
> (select * from Table_A, Table_B where
> Table_A.PK = Table_B.FK (+))>
> If my subquery returned one row, Table_A was history (LoL..thank God
> for
> RollBacks)!!
>
> I also tried:
>
> Delete from
> (select * from Table_A, Table_B where
> Table_A.PK = Table_B.FK (+))
>
> But this attempted fails to "SPECIFY" exactly which table to apply the
> delete method to.
>
> I know in Sybase you would do something like
>
> delete Table_A from Table_A, Table_B where Table_A*=Table_B
>
> Basically, I'm attempting to delete rows from Table_A based on a
> criteria
> that requires the presence of Table_B.
>
> Anyone out there have any ideas?????
Don't use tables? :-)
Instead use objects.