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 -> sql joints

sql joints

From: SPIDERMAN <consultant2b_at_hotmail.com>
Date: Wed, 16 Jul 2003 05:59:48 GMT
Message-ID: <oR5Ra.29466$R92.15996@news2.central.cox.net>


Hi gurus,

 I have 4 tables as follows:

  1. Buyers: BuyerID
  2. BuyersSellers: BuyerID, SellerID
  3. Sellers: SellerID
  4. Honda: SellerID, ModelID

I want to get all the buyers, regardless whether they buy Honda or any other 'make' (Ford, BMW, etc.). So I made the query as

select b.BuyerID, s.SellerID, h.ModelID from Buyers b, BuyersSellers bs, Sellers s, Honda h where b.BuyerID = bs.BuyerId (+) and

          bs.SellerID = s.SellerID (+) and
          s.SellerID = h.SellerID (+) and
          h.ModelID = '007'

but it returned fewer number of records than that from Buyers table. I ran the following:

select b.BuyerID, s.SellerID
from Buyers b, BuyersSellers bs, Sellers s, Honda h where b.BuyerID = bs.BuyerId (+) and

          bs.SellerID = s.SellerID (+)

it returned the correct number of records.

How can I modify the first query so that it will return the correct number of records? It seems to me here that the outer joint is good only for 2 consecutive joints (Buyers->BuiyersSellers->Sellers). What's wrong? Thanks in advance. Received on Wed Jul 16 2003 - 00:59:48 CDT

Original text of this message

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