INF: Restrictions for Multi-Table Outer JoinsID: Q45301
|
The following information discusses how many tables can be involved in an outer join, and the restrictions involved.
Outer joins cannot be nested (t1*=t2*=t3 is illegal), but multiple
outer joins are permitted if they aren't nested (t1=*t2*=t3 is
allowed).
Inner joins cannot be nested inside the outer join (t1*=t2=t3 is
illegal, but t1=t2*=t3 is allowed).
t1*=t2=*t3 is also permitted. It takes the Cartesian product of t1 and
t3, then outer-joins the result to t2.
As long as the semantic rules are not violated, the limit is 16
tables, just as with an inner join.
The semantics regarding outer joins can be represented graphically
with the tables as nodes and the joins as arcs between the nodes.
Outer joins are directed arcs with the arrow pointing to the "inner"
table of the pair.
The following is a graphic representation:
select * from t1,t2 where t1.c1*=t2.c1 is t1 --> t2
select * from t1,t2 where t1.c1=*t2.c1 is t1 <-- t2
select * from t1,t2 where t1.c1=t2.c1 is t1 --- t2
illegal legal
t1-->t2-->t3 t1-->t2<--t3 t1-->t2<--t3 t1-->t2<--t3
t1<--t2<--t3 | ^ t1<--t2-->t3 | |
t1-->t2---t3 | | t1---t2-->t3 +--------+
+--------+
t3 t3 t3 t3
^ | ^ |
| v | v
t2<--t1<--t4 t2-->t1-->t4 t2<--t1-->t4 t2-->t1<--t4
| ^ | ^
v | v |
t5 t5 t5 t5
Additional query words: Transact-SQL
Keywords : kbprg SSrvServer
Version : OS/2:4.2 WINNT: 6.0, 6.5
Platform : OS/2 winnt
Issue type :
Last Reviewed: March 6, 1999