Re: Multi Table Join

From: Doug Henderson <djhender_at_canuck.com>
Date: 1995/07/08
Message-ID: <3tljap$j1q_at_mp.canuck.com>#1/1


galigian_at_on.bell.ca wrote:

>Here's one for you guys. I need to perform a multi table join.
>For example, the tables are as follows.

>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.

How about this

select a.name, b.date, b.hours_worked, to_number(null) expenses   from a, b where a.name = b.name
union
select a.name, to_date(null) date, to_number(null) hours_worked, c.expenses
  from a, c where a.name = c.name
order by 1, 2;

NAME DATE HOURS_WORKED EXPENSES ---- ----- ------------ --------

John    Jan25       7.5
John    Jan26       7.5
John    Jan27       7.5
John                               20

--
Doug Henderson, Glen Coulee Consulting, Calgary, Alberta
[Sent by Free Agent 0.55]
Received on Sat Jul 08 1995 - 00:00:00 CEST

Original text of this message