>>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 ;
> ORDER By whatever ;
> 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!