Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
UNION SELECT
Message
De
01/12/1998 16:36:59
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00162880
Message ID:
00162976
Vues:
19
>>First, you need to encapsulate the SELECT for the UNION clause within parentheses. Second, why do this in two steps?
>>
>>Why not:
>>
>>SELECT s.Date AS DateFld, SUM(S.Count) AS SumNum ;
>>  FROM SAMPLE S ;
>>  INTO CURSOR Three ;
>>UNION ALL (SELECT E.Date AS DateFld, E.Number AS SumNum ;
>>  FROM Example E )
>>
>>
>>I renamed fields because I'm allergic to using reserved names for fields - I'd avoid naming fields things like Count, Date, Number and the like to avoid confusing the interpreter, and avoid problems when going to another environment where the DML is pickier about reserved word collisions than VFP.
>
>One modification:>
>SELECT s.Date AS DateFld, SUM(S.Count) AS SumNum ;
>  FROM SAMPLE S ;
>UNION ALL (SELECT E.Date AS DateFld, E.Number AS SumNum ;
>  FROM Example E ) ;
>  GROUP BY whatever ;   && optional
>  ORDER By whatever ;   && optional
>  INTO CURSOR Three ;
>
>All INTO, GROUP BY, and ORDER clauses go at the end of the SQL command.

Absolutely what it says in the docs; I've just gotten away with putting the INTO clause in the first statement before!
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform