Move your INTO CURSOR clause right after the first FROM clause. BTW, it's a good practice to follow the sequence of the clauses from the help file (eg as they are documented). Although SELECT SQL is very tolerant regarding this issue, not doing so can cause unexpected/unclear errors.
On the other hand: Is GROUP BY applied only to the second SELECT (from the UNION clause)? If it must be applied to the final result, you should add an GROUP BY 1 to the first SELECT.
Vlad
>The following sql select statement has been working fine in Foxpro version 2.6 for Windows and compiles w/o error. When we compile the program containing the sql select statement in Visual Foxpro ver. 5.0 (upgrading a client's system), we get a syntax error. Further investigation indicates that it is having a problem w/the "group by" clause. Does anyone know why there is now a syntax error in VFP 5.0? Any ideas how to fix it? Thanks in advance for the help.
>
>SELECT a.item, a.loctid FROM a_ictran a, a_icitem b ;
> WHERE RIGHT(a.trantyp,1) = "R" ;
> .AND. BETWEEN(a.item, lc_bitem, lc_eitem) ;
>UNION ;
> SELECT a.item, a.loctid FROM a_icytrn a, a_icitem b ;
> WHERE RIGHT(a.trantyp,1) = "R" ;
> .AND. BETWEEN(a.loctid, lc_bloca, lc_eloca) ;
> INTO CURSOR temp1 ;
> GROUP BY 1 ;
> ORDER BY 1
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only