Re: Multi Table Join

From: Kim Ng <kimmng_at_pebbles.uswnvg.com>
Date: 1995/07/11
Message-ID: <3tuhk1$9uq_at_fred.uswnvg.com>#1/1


: Table A (Primary) Table B Table C
: ----------------- ------- -------
: Key = NAME NAME NAME
: HOURS_WORKED EXPENSES
: DATE
: The relationship between A and B is one to many , and
: the relationship between A and C is one to many.

Yep. You're absolutely right. You will get the "expenses" duplicated for each of the rows in table B and each row of table b duplicated for each of table C. It is like doing "select * from tableA, tableB" which will return m*n rows where m is number of rows in tableA and n is the number of rows in tableB.

There are 2 ways out that I can think of: (1) add another column(s) in table B and/or C that will uniquely tie the

    2 tables together. For example, if expenses are only valid for     working days, you can add "DATE" to table C and have that condition in     your join.
(2) Use cursors, if possible. For example, for each of the rows returned by

    joining tables A and B, get the records in table C.

--
Kim Ng
(standard disclaimer applies. If you don't know what it is, you shouldn't be
reading this)
Received on Tue Jul 11 1995 - 00:00:00 CEST

Original text of this message