Re: Simple SQL Query
Date: Thu, 7 Jan 2010 11:12:08 -0600
Message-ID: <94e86aed1001070912u3741ad6r64fde5beb6fe12d0_at_mail.gmail.com>
Seems like a basic inner join would do what you want, no?
Using ANSI join syntax:
select first.id
from first join second on first.id=second.id;
Don.
On Thu, Jan 7, 2010 at 11:06 AM, Joel Slowik <jslowik_at_cps92.com> wrote:
> Had you tried?:
>
>
>
> Select first.id
>
> From first
>
> Where not exists (select second.id
>
> From second
>
> Where second.id = first.id)
>
>
>
> From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org]
> On Behalf Of Pani Babu
> Sent: Thursday, January 07, 2010 12:04 PM
> To: oracle-l_at_freelists.org
> Subject: Simple SQL Query
>
>
>
> I have a simple SQL query which lists all the records that are not in a
> second table.
>
> select first.id from first
> where first.id not in (select id from second);
>
> As the second table is very huge, it takes a very long to process the query.
> Is there a way to rewrite the query to run it quicker?
>
> Confidentiality Note: This electronic message transmission is intended only
> for the person or entity to which it is addressed and may contain
> information that is privileged, confidential or otherwise protected from
> disclosure. If you have received this transmission, but are not the intended
> recipient, you are hereby notified that any disclosure, copying,
> distribution or use of the contents of this information is strictly
> prohibited. If you have received this e-mail in error, please contact
> Continuum Performance Systems at {203.245.5000} and delete and destroy the
> original message and all copies.
-- Don Seiler http://seilerwerks.wordpress.com ultimate: http://www.mufc.us -- http://www.freelists.org/webpage/oracle-lReceived on Thu Jan 07 2010 - 11:12:08 CST