Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to combine two cursors?
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
01411721
Message ID:
01411884
Vues:
40
>>>The solution was as following:
>>>
>>>
>>>if reccount("MyCursor1") > reccount("MyCursor2")
>>>    select MyCursor1.* from MyCursor1 LEFT JOIN MyCursor2 on MyCursor1.ID = MyCursor2.ID INTO MyCursor3
>>>else
>>>   select MyCursor2.* from MyCursor2 LEFT JOIN MyCursor1 on MyCursor1.ID = MyCursor2.ID INTO MyCursor3
>>>endif
>>>
>>
>>You realize that with this solution you don't really combine records, you end up with the cursor having most records.
>>
>>Unless, of course, ID field is not unique in these cursors.
>
>The ID is unique. And you are right. There is a flaw in my flaw in my approach. I wonder if use FULL JOIN if it works then.

One more solution - use UNION as I suggested from the beginning, but exclude Memo fields. Then use LEFT join to each of your cursor to fetch memo fields. In fact, if the difference is based on ID, you can first grab IDs only and then join with the rest of the fields.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform