Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Is there a faster way???

Re: Is there a faster way???

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Wed, 5 Apr 2000 18:30:35 +0200
Message-ID: <954952288.28129.0.pluto.d4ee154e@news.demon.nl>


Delete from Frt.Tld_data_in a
where exists
(select 'x' from frt.freight b
 where b.frt_order = a.frt_order

 and     b.bl = a.bl
 and     b.pro = a.pro)

and a.accessorial_rc = 'RPAY';

One correlated subquery instead of three.

Hth,

Sybrand Bakker, Oracle DBA

Andy <abruskoNOabSPAM_at_binney-smith.com.invalid> wrote in message news:01334142.201a9c2e_at_usw-ex0106-046.remarq.com...
> Hi,
> I have the following query that I have written to delete all of
> the rows in a table if it finds a matching row (based upon 4
> columns) in another table. The 1st table has a few hundred rows
> and the 2nd table has a few hundred thousand rows. The query is
> running for a very long time. Is there a more efficient way to
> code this? Here is the query:
>
> Delete from Frt.Tld_data_in a
> where a.frt_order in
> (select frt_order from frt.freight b
> where a.frt_order = b.frt_order) and
> a.bl in
> (select bl from frt.freight b
> where a.bl = b.bl) and
> a.pro in
> (select pro from frt.freight b
> where a.pro = b.pro) and
> (a.accessorial_rc = 'RPAY');
>
> Thanks alot!
> Andy
>
> * Sent from RemarQ http://www.remarq.com The Internet's Discussion Network
*
> The fastest and easiest way to search and participate in Usenet - Free!
>
Received on Wed Apr 05 2000 - 11:30:35 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US