Hi Doug,
If there is a [ssno] field in the table, it takes precedence over an alias in SELECT list. So, the ORDER BY clause is translated as ORDER BY temp.ssno, temp.ssn. In VFP9, if DISTINCT clause is used, all ORDER BY items should present in SELECT list. The temp.ssno is not in the SELECT list, that is why the error is expected.
BTW, even though the query worked in prior versions, the result was not ordered by right(a.ssn,4).
Thanks,
Aleksey.
>This used to work fine in vfp3
>
>select distinct last_name, first_name, mid_name, ;
> address1, address2, city, state, zip_code, ;
> ' ' as packet_id,ssn, right(a.ssn,4) as ssno ;
> from temp ;
> into cursor address ;
> order by ssno, ssn
>
>How to fix in vfp9 besides making two statements?
>How to find all like this in code?