Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Join table cause unwanted duplicate
Message
De
09/01/2002 06:38:54
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
08/01/2002 20:35:26
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00601834
Message ID:
00602411
Vues:
21
>>You can get duplicates for several reasons.
>>
>>1) If one table has 3 copies on the matching field, and the other 4, you will get 3*4=12 duplicates in the result set.
>>...
>Yes, the 1) case.
>
>I want result is 1-by-1 matching, once match, skip it..
>but both side data may missing...
>
>What should I do?
>Thanks

Two solutions:

a) Eliminate the duplicates with a condition. For instance, if it is caused by empty records on both sides, add the clause WHERE NOT EMPTY(table1.KeyField) AND NOT EMPTY(table2.KeyField)

b) Joins are often done on primary keys / foreign keys. Make sure the PK is really unique.

Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform