Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Dummy - Me
Message
From
30/10/2000 21:49:22
Gavin Reid
L & M Marketing Pty Ltd
Frenchs Forest, Australia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00436193
Message ID:
00436199
Views:
17
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
Map
View

Click here to load this message in the networking platform