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: Tieing table together

Re: Tieing table together

From: MSN <cyberming_at_hotmail.com>
Date: Fri, 8 Dec 2000 08:27:45 -0500
Message-ID: <90qnjg$227nq$1@ID-58123.news.dfncis.de>

I believe brian you need AND C.A_Id = D.A_Id in your select statement to prevent cartesian join b/w C and D

Anwer
"Brian Tkatch" <SPAMBLOCK.Maxwell_Smart_at_ThePentagon.com.SPAMBLOCK> wrote in message news:3a3032fc.1470406593_at_news.alt.net...
> Let's say I have four tables. Two are lookup tables, the third uses
> one lookup table, and the forth uses both.
>
> A
> ===
> Id
> Name
>
> B
> ===
> Id
> Name
>
> C
> ====
> Id
> A_Id
> Name
>
> D
> ====
> A_Id
> B_Id
> Name
>
> To select from all the tables, I could do:
>
> SELECT
> A.Name A_Name,
> B.Name B_Name,
> C.Name C_Name,
> D.Name D_Name
> FROM
> A,
> B,
> C,
> D
> WHERE
> A.Id = C.A_Id
> AND A.Id = D.A_Id
> AND B.Id = D.B_Id;
>
>
> I could also add
>
> AND C.A_Id = D.A_Id
>
> which is completely extra as both C and D are already tied to A,
> thereby forcing them to be equal. I am wondering if it helps at all or
> just puts extra strain on the processor.
>
> Brian;
> /
>
>
>
>
Received on Fri Dec 08 2000 - 07:27:45 CST

Original text of this message

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