Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> sql joints
Hi gurus,
I have 4 tables as follows:
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