PRB: ORDER BY Field in Result Set Without Being in Field List
Article ID: 143249
Article Last Modified on 9/30/2003
APPLIES TO
- Microsoft Visual FoxPro 3.0 Standard Edition
- Microsoft Visual FoxPro 3.0b Standard Edition
This article was previously published under Q143249
SYMPTOMS
When using the ORDER BY clause of a SQL SELECT statement, you must include
the the ORDER BY field in the field list. If the ORDER BY field is not
included in the field list, it is added by FoxPro without an error.
STATUS
This behavior is by design. It is clearly documented in the Language
Reference and help file that the ORDER BY field must be in the field list.
The following quote is from the help file under the SELECT SQL topic:
ORDER BY sorts query results based on data in one or more columns.
Each Order_Item must correspond to a column in the query results
Additional query words: VFoxWin
Keywords: KB143249