From: "Jon M." <Jonatmfr@eei.org>
Subject: Re: hierarchy table design question
Date: 2000/05/05
Message-ID: <39131005$0$10088@wodc7nh0.news.uu.net>#1/1
References: <8ev0nm$b23$1@nnrp1.deja.com>
X-Trace: reader0.news.uu.net 957550597 10088 204.254.108.80
Newsgroups: comp.databases.theory
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3


With SQL:
select TC.* from TA, TB, TC Where TA.pk = [whatever] and TA.pk = TB.fk and
TB.pk = TC.fk

pk=primary key
fk=foreign key

HTH,
Jon Myers

dtong123@my-deja.com wrote in message <8ev0nm$b23$1@nnrp1.deja.com>...
>Hello,
>
>Let say I have the following schema.
>
>Table A has a 1-M relationship with Table B.
>Table B has a 1-M relationship with Table C.
>
>I want to get related rows from Table C by given
>Table A's primary key. The following is pseduo
>code from application layer.
>1. Get all related rows from B by providing A's pk
>2. For each row of B, get all rows from c.
>
>U see if I have 1..n rows of B, then I have to
>loop through 1..n times to retrieve Cs. All these
>code is from app layer, and therefor it is
>involved the network traffic..etc.
>
>What is the best way to solve this problem?
>
>Thanks,
>D. T.
>
>
>
>
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.




