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

Home -> Community -> Usenet -> c.d.o.tools -> Re: SQL join to identify missing records?

Re: SQL join to identify missing records?

From: Mike Dwyer <dwyermj_at_co>
Date: Thu, 24 Aug 2000 08:15:34 -0600
Message-ID: <fbap5.21$VK3.8475@wdc-read-01.qwest.net>

Standard syntax would be:
select -columnlist- from table1, table2
where table1.join-column = table2.join-column (+);

If you want ONLY the rows that do not have a match in table2, add this: and table2.join-column is null

Another approach would be use of a subquery: select -columnlist- from table1 where not exists (   select 0 from table2 where table2.join-column = table1.join-column);

If you only need the join column, you can use the MINUS approach: select join-column from table1 minus select join-column from table2;

"Susie Grace" <hlng_at_usa.net> wrote in message news:8o25cv$a4i$1_at_nnrp1.deja.com...
> I have 2 tables that are joined, and want to identify records that are
> in table1 but NOT in table2?
>
> What is the sample syntax?
>
> Thanks in advance.
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Thu Aug 24 2000 - 09:15:34 CDT

Original text of this message

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