Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
FULL JOIN is strange
Message
From
06/10/2003 07:45:13
 
 
To
06/10/2003 06:57:42
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00835102
Message ID:
00835305
Views:
19
Hi Hilmar,

----
In this case, not exactly: You gave an example for a full join without a join condition. I would expect this to give a Cartesian product, and I have used this myself (but with another syntax).
----

Cartesian product is not unique:
**** inner Cartesian product
SELECT * FROM T1 INNER JOIN T2 ON .T.
SELECT * FROM T1,T2
* SELECT * FROM T1 CROSS JOIN T2 on SQL Server

**** outer Cartesian product
SELECT * FROM T1 LEFT  JOIN T2 ON .T.
SELECT * FROM T1 RIGHT JOIN T2 ON .T.
SELECT * FROM T1 FULL  JOIN T2 ON .T.
are differents Cartesian product.

You cannot implement
SELECT * FROM T1 FULL JOIN T2 ON .T.
with a other simple SELECT command
( minimum is need a
SELECT ... LEFT JOIN ... UNION ALL SELECT ... RIGHT JOIN ... WHERE ....)
with 3 join Tables on VFP is nearly impossible with a single query.

The problem occurs also for subset of FULL Cartesian product:
CREATE CURSOR T1 (F1 I )
CREATE CURSOR T2 (F2 I )
INSERT INTO T1 VALUES (1)
INSERT INTO T1 VALUES (2)
INSERT INTO T2 VALUES (1)
SELECT * FROM T1 FULL JOIN T2 ON F1=m.x AND F2=F1  && this is OK
x=1
SELECT * FROM T1 FULL JOIN T2 ON F1=m.x AND F2=m.x && this is NOK
Any not optimized FULL JOIN can return bad records,
control VFP SELECT optimization is hard ( in general ),
then FULL JOIN is hard to use with sure result.

I hope VFP8 sp1 fixed this bug.

Fabio
Previous
Reply
Map
View

Click here to load this message in the networking platform