General information
Category:
Coding, syntax & commands
Hi Bob,
Instead of using the field name in the order by clause, why not use its number or give it a different field name?
SELECT mydata.name, mydata.type, mydata.date ;
FROM mydata ;
ORDER BY 1,2,3
OR
SELECT mydata.name AS name_f, mydata.type AS type_f, mydata.date AS date_f ;
FROM mydata ;
ORDER BY name_f, type_f, date_f
Hope this helps,
Gavin...
>Has anyone out there, ever done the following
>Named fields with names like 'mydata.name' or mydata.type or mydata.date
>or anything as stupid as that.
>
>Long story, but it has happend on a legacy system.
>The problem I just started cropping up, when I was attemping to do sql querries on the data, and all sorts of error started happening.
>
>I tracked down the source of the sql error's and it was with the order by clause.... vfp's sql commands, dont allow for these reserved words to be used as fields in the order by clause.
>
>So for now, I fixed it, and made it work by putting the data in a cursor, and adding an additional field with a proper name like mycursor.f_name and put the values there... etc, it works... not a pretty picture,
>
>
>Is there better work arround, for this type of dummy mistake ?
>
>Thanks in advance.
>Bob Lee
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only