Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Combining to SELECT statements (or two cursors)
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00043707
Message ID:
00043816
Vues:
33
>>>I'm looking for advice on how I can either combine the following two select statements into one or how I can combine the result sets into one so I can use the data for a report.
>>>
>>>SELECT;
>>>udds1, udds2, name;
>>>FROM drivauth_view WHERE (ISNULL(udds1) = .f.);
>>>AND (EMPTY(udds1) = .f.);
>>>INTO CURSOR report1
>>>
>>>SELECT;
>>>udds1, udds2, name;
>>>FROM drivauth_view WHERE (ISNULL(udds2) = .f.);
>>>AND (EMPTY(udds2) = .f.)
>>>INTO CURSOR report2
>>
>>You can do this two ways (unless I am missing something here).
>>
>>1) Do a union of the two selects above. Example
>>
>>select * from table1 where x=k;
>>union;
>>select * from table2 where y=h
>>into cursor bigreport
>>
>>2) Union the two cursors together after the select are done (less efficent)
>>
>>select * from report1;
>>union;
>>select * from report2
>>
>>Note: programmers not in a collective agreement with be unable to use this command. :-)
>>
>>Hope this helps.
>
>Thanks Evan! Union All works perfectly!
>
>Jeff

Be aware that you might have duplicate records in the result if you use UNION ALL.

And try to use "NOT EMPTY" and "NOT ISNULL" instead of "=.f." It should be faster.

Vlad

Vlad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform