>Can a name expression (or Macro) be used in the ORDER BY clause of a SELECT statement? I have tried the following, but get an error.
>
>
>m.lcSQLSortCol = "lastname"
>
>SELECT PatientID, lastname, firstname FROM Patients INTO CURSOR csrResult ;
> ORDER BY (m.lcSQLSortCol)
>
>
>I get the error: SQL: Column 'LCSQLSORTCOL' is not found
>
>Thanks for your help.
>
>Jim
Macro can be used. Nothing else.
SELECT PatientID, lastname, firstname FROM Patients INTO CURSOR csrResult ;
ORDER BY &lcSQLSortCol
Same rule applies for all other parts of select statement.
If it's not broken, fix it until it is.
My Blog