That was the first error that I noticed. The second is the calculated column. In VFP you can not ORDER BY calculated coumn.
You may want to use select field1, ... from (select field,..., calculated field from ... order by calculated field)
>>Looks like you're missing a space after ], e.g. [ ] as fld8 or cast("" as C(1)) as fld8
>
>Did not make a difference.
If it's not broken, fix it until it is.
My Blog