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

Home -> Community -> Usenet -> c.d.o.server -> Re: Help with SQL statement

Re: Help with SQL statement

From: <oratune_at_aol.com>
Date: Mon, 16 Oct 2000 15:37:20 GMT
Message-ID: <8sf7bg$ij6$1@nnrp1.deja.com>

In article <8sf0ed$c82$1_at_nnrp1.deja.com>,   umeshpatel_at_my-deja.com wrote:
> Try:
> select a.barcode
> from tablea a, tableb b
> where a.barcode = b.barcode (+)
> and b.barcode is null;
>
> In article <8sess8$sf$1_at_news.inet.tele.dk>,
> "Peter Kirk" <peter_kirk_at_alpha-gruppen.dk> wrote:
> > Hi there
> >
> > I am *very* inexperienced with sql, and I am trying to write a
 statement to
> > select certain rows from one table, given that no corresponding row
 exists
> > in another table.
> >
> > That is, I have TableA, and TableB.
> >
> > TableA has these columns of interest:
> > barcode;
> > description;
> >
> > TableB has these columns of interest
> > barcode;
> > description;
> >
> > I want to find all "barcodes" that are in TableA, but not in TableB.
 How can
> > I do this is a single sql statement?
> >
> > I am experimenting with "outer join" at the moment, but I'm not sure
 if this
> > is entirely correct, and I can't seem to find the correct syntax.
> >
> > Thanks for any help,
> > Peter.
> >
> >
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>

Try one of these:

select barcode
from tableB
minus
select barcode
from tableA

or

select barcode
from tableB
where barcode not in (select barcode from tableA)

--
David Fitzjarrell
Oracle Certified DBA


Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Mon Oct 16 2000 - 10:37:20 CDT

Original text of this message

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