Subject | Re: [firebird-support] Outer Join |
---|---|
Author | Helen Borrie |
Post date | 2003-11-07T22:14:57Z |
At 09:21 PM 7/11/2003 +0000, you wrote:
details it can't match (as you saw). Also you have an extra "Master"
floating in there that doesn't belong there.
Select Master.Master_ID,
Detail1.Master_ID,
Detail2.Master_ID,
from Master
join Detail2 on (Master.Master_ID = Detail2.Master_ID),
join Detail1 on (Master.Master_ID = Detail1.Master_ID)
heLen
>I have a master/detail relationship with there being one master tableLeft join is not what you want here, because it will return null rows for
>and 2 detail tables. Only one of the 2 detail tables can have a
>record matching the master--there may be done. I wanted to find out
>which one did not. I created this query
>
>Select Master.Master_ID,
> Detail1.Master_ID,
> Detail2.Master_ID,
> from Master left join Detail2 on
> (Master.Master_ID = Detail2.Master_ID),
> Master left join Detail1 on
> (Master.Master_ID = Detail1.Master_ID)
>
>I wanted a list of every record in the master, and the 2nd column
>value being not null if it existed in Detail1 and likewise for
>Detail2's column--but I didn't achive this--I got a whole lot more
>records then I wanted.
>
>How can I achieve this?
details it can't match (as you saw). Also you have an extra "Master"
floating in there that doesn't belong there.
Select Master.Master_ID,
Detail1.Master_ID,
Detail2.Master_ID,
from Master
join Detail2 on (Master.Master_ID = Detail2.Master_ID),
join Detail1 on (Master.Master_ID = Detail1.Master_ID)
heLen