Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Join table cause unwanted duplicate
Message
From
09/01/2002 06:38:54
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
08/01/2002 20:35:26
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00601834
Message ID:
00602411
Views:
22
>>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)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform