Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Help me with this query!
First, I think commas will perform better than concatenation:
delete T1
where (C1, C2) in (select C1, C2 from T2);
However, depending on your data, you'll often-to-usually get beter mileage out of:
delete T1
where exists
(
select 'x'
from T2
where T2.C1 = T1.C1
and T2.C2 = T1.C1
)
/
Hope this helps,
Yosi
B N RAMAMOHAN wrote:
> Hi,
>
> I have a table T1 which has two columns C1 & C2 which are
> composite PK. There is another table T2 which contains part
> of these PK's (but they are not PKs here). Now I have to
> delete the rows from T1 for which PK values are in T2.
>
> One query that comes to my mind is:
>
> delete T1
> where C1||C2 in (select C1||C2 from T2);
>
> Is there any other efficient way of doing this?
>
> Please help me...
>
> Regards,
> Mohan
>
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: B N RAMAMOHAN
> INET: ramamohan.bn_at_tatainfotech.com
>
> Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> San Diego, California -- Public Internet access / Mailing Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
> also send the HELP command for other information (like subscribing).
-- Thanks, Yosi --------------------------------------------------------- Yosi GreenfieldReceived on Mon Jan 15 2001 - 12:17:08 CST