Re: Extremely very complex SQL query with outer's
Posted in 1998
Ian Clark wrote:
>
> Hi All,
>
> I'm not sure how easy this question is to answer but here goes.
>
> I am perusing some code that has the following statement:
>
> SELECT some_stuff>
> FROM p1, outer ( menuln p2, outer ( menuln p3,
> outer ( menuln p4, outer ( menuln p5 ) ) ) )
>
> WHERE some_conditions
>
> For goodness sake...what's with all the outer's? :-)
OK, this is just a five table nested outer join, whew!
It says:
1) Join menuln aliased as p4 to itself aliased as p5, if there
are no matching rows in p5 return the row from p4 anyway joined to a
null p5 row (this is an outer join).
2) Take the result of 1) and outer join it to each matching row of
menuln aliased as p3.
3) Take the result of 2) and outer join it to each matching row of
menuln aliased as p2.
4) Take the result of 3) and outer join it to each matching row of
menuln aliased as p1 (I assume you lost the first table name via typo).
This looks like a five level parts breakout allowing for less than
five levels by using the nested outer joins.
Art S. Kagel