Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to combine two cursors?
Message
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01411721
Message ID:
01411895
Views:
41
>>>>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.
>
>You can use FULL OUTER JOIN with NVL(FirstCursor.Field, SecondCursor.Field) as Field approach. Or use the solution with UNION ALL and LEFT JOIN with where IS NULL.
>
>I'm not sure which would perform better.

Thank you. I got both of your messages. I will play with different approaches and see which one works better for me.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform