Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
FULL JOIN is strange
Message
De
06/10/2003 07:45:13
 
 
À
06/10/2003 06:57:42
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00835102
Message ID:
00835305
Vues:
20
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform