>True.
>
>But if we are speaking about the original problem.
>Again assuming that ssno exists in the underlying table.
>
>select distinct last_name, first_name, mid_name, ;
> address1, address2, city, state, zip_code, ;
> ' ' as packet_id, ssn, right(ssn,4) as ssno ;
> from temp ;
> order by ssno, ssn
>
>Does work in 8. Does work in MS SQL ( with a few changes :) ).
>Does not work in 9.
You still missing the point. It doesn't work in VFP8 because result is sorted on the ssno field not on the ssno expression from the query. With DISTINCT clause and the ssno field not presented in the field list there's no way to be sure from which record the field will come. It's basicaly the same problem as with GROUP BY not including all non-aggregated fields.
--sb--